From 1c09d9fb128f4aabb680a2a3d83c0e2874258e4b Mon Sep 17 00:00:00 2001 From: yulingtianxia Date: Tue, 7 May 2019 23:46:14 +0800 Subject: [PATCH] fix macos api issue. --- MTDemo/MTDemo.xcodeproj/project.pbxproj | 10 +++++----- .../xcshareddata/xcschemes/MTDemo.xcscheme | 2 +- .../xcschemes/MessageThrottle iOS.xcscheme | 2 +- .../xcschemes/MessageThrottle watchOS.xcscheme | 6 +++--- MessageThrottle.podspec | 2 +- MessageThrottle/MessageThrottle.h | 2 +- MessageThrottle/MessageThrottle.m | 4 +++- 7 files changed, 15 insertions(+), 13 deletions(-) diff --git a/MTDemo/MTDemo.xcodeproj/project.pbxproj b/MTDemo/MTDemo.xcodeproj/project.pbxproj index 0be5156..79d2dc9 100644 --- a/MTDemo/MTDemo.xcodeproj/project.pbxproj +++ b/MTDemo/MTDemo.xcodeproj/project.pbxproj @@ -374,7 +374,7 @@ A4DB9ECC1FA709A400826A8F /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 0930; + LastUpgradeCheck = 1020; ORGANIZATIONNAME = "杨萧玉"; TargetAttributes = { A489952E1FAE2F6200A7A58A = { @@ -601,7 +601,7 @@ DYLIB_INSTALL_NAME_BASE = "@rpath"; INFOPLIST_FILE = ../MessageThrottle/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 11.1; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.yulingtianxia.MessageThrottle; PRODUCT_NAME = MessageThrottle; @@ -626,7 +626,7 @@ DYLIB_INSTALL_NAME_BASE = "@rpath"; INFOPLIST_FILE = ../MessageThrottle/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 11.1; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.yulingtianxia.MessageThrottle; PRODUCT_NAME = MessageThrottle; @@ -838,7 +838,7 @@ isa = XCBuildConfiguration; buildSettings = { CLANG_ENABLE_OBJC_WEAK = YES; - CODE_SIGN_IDENTITY = "Mac Developer"; + CODE_SIGN_IDENTITY = ""; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; CURRENT_PROJECT_VERSION = 1; @@ -867,7 +867,7 @@ isa = XCBuildConfiguration; buildSettings = { CLANG_ENABLE_OBJC_WEAK = YES; - CODE_SIGN_IDENTITY = "Mac Developer"; + CODE_SIGN_IDENTITY = ""; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; CURRENT_PROJECT_VERSION = 1; diff --git a/MTDemo/MTDemo.xcodeproj/xcshareddata/xcschemes/MTDemo.xcscheme b/MTDemo/MTDemo.xcodeproj/xcshareddata/xcschemes/MTDemo.xcscheme index 43a3f40..199e165 100644 --- a/MTDemo/MTDemo.xcodeproj/xcshareddata/xcschemes/MTDemo.xcscheme +++ b/MTDemo/MTDemo.xcodeproj/xcshareddata/xcschemes/MTDemo.xcscheme @@ -1,6 +1,6 @@ @@ -46,7 +46,7 @@ @@ -64,7 +64,7 @@ diff --git a/MessageThrottle.podspec b/MessageThrottle.podspec index 000cbf2..0e14f25 100644 --- a/MessageThrottle.podspec +++ b/MessageThrottle.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "MessageThrottle" -s.version = "1.3.3" +s.version = "1.3.4" s.summary = "A lightweight Objective-C message throttle and debounce library." s.description = <<-DESC MessageThrottle is a lightweight, simple library for controlling frequency of forwarding Objective-C messages. You can choose to control existing methods per instance or per class. It's an implementation of function throttle/debounce developed with Objective-C runtime. diff --git a/MessageThrottle/MessageThrottle.h b/MessageThrottle/MessageThrottle.h index a672419..e0b6fea 100644 --- a/MessageThrottle/MessageThrottle.h +++ b/MessageThrottle/MessageThrottle.h @@ -125,7 +125,7 @@ Class mt_metaClass(Class cls); iOS、macOS 和 tvOS 下杀掉 App 后会自动调用。 请在需要保存持久化规则的时候手动调用此方法。 */ -- (void)savePersistentRules; +- (void)savePersistentRules API_AVAILABLE(macosx(10.11)); @end diff --git a/MessageThrottle/MessageThrottle.m b/MessageThrottle/MessageThrottle.m index 74c5448..9ee5a99 100644 --- a/MessageThrottle/MessageThrottle.m +++ b/MessageThrottle/MessageThrottle.m @@ -317,7 +317,9 @@ - (instancetype)init - (void)handleAppWillTerminateNotification:(NSNotification *)notification { - [self savePersistentRules]; + if (@available(macOS 10.11, *)) { + [self savePersistentRules]; + } } - (void)savePersistentRules