From b078b1908a4f80296c9bb3e7af1f2e78813dbf0d Mon Sep 17 00:00:00 2001 From: Sebastian Hagedorn Date: Tue, 4 Sep 2018 18:11:14 +0200 Subject: [PATCH 1/8] Update deployment target to iOS 9 * Allow Xcode to make recommended project changes * Use the same deployment target setting for all targets --- ISHPermissionKit.xcodeproj/project.pbxproj | 38 ++++++++++++++----- .../xcshareddata/IDEWorkspaceChecks.plist | 8 ++++ .../xcschemes/ISHPermissionKit.xcscheme | 2 +- .../xcschemes/ISHPermissionKitLib.xcscheme | 2 +- 4 files changed, 38 insertions(+), 12 deletions(-) create mode 100644 ISHPermissionKit.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist diff --git a/ISHPermissionKit.xcodeproj/project.pbxproj b/ISHPermissionKit.xcodeproj/project.pbxproj index 331594c..3c84940 100644 --- a/ISHPermissionKit.xcodeproj/project.pbxproj +++ b/ISHPermissionKit.xcodeproj/project.pbxproj @@ -490,7 +490,7 @@ DCC1BF9C195B174200362559 /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 0810; + LastUpgradeCheck = 1000; ORGANIZATIONNAME = "iosphere GmbH"; TargetAttributes = { DCAEF7C9195C60070074EB5B = { @@ -627,15 +627,23 @@ CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; CLANG_WARN_NULLABLE_TO_NONNULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; @@ -659,7 +667,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 7.0; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; ISH_BUNDLE_VERSION = 0; ISH_BUNDLE_VERSION_MAJOR = 2; ISH_BUNDLE_VERSION_MINOR = 0; @@ -685,7 +693,6 @@ FRAMEWORK_VERSION = "${ISH_BUNDLE_VERSION_SHORT}"; INFOPLIST_FILE = ISHPermissionKit/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "de.iosphere.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -712,7 +719,6 @@ isa = XCBuildConfiguration; buildSettings = { INFOPLIST_FILE = ISHPermissionKitTests/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; METAL_ENABLE_DEBUG_INFO = YES; OTHER_LDFLAGS = "-ObjC"; @@ -761,15 +767,23 @@ CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; CLANG_WARN_NULLABLE_TO_NONNULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; @@ -793,7 +807,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 7.0; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; ISH_BUNDLE_VERSION = 0; ISH_BUNDLE_VERSION_MAJOR = 2; ISH_BUNDLE_VERSION_MINOR = 0; @@ -817,15 +831,23 @@ CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; CLANG_WARN_NULLABLE_TO_NONNULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; @@ -842,7 +864,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 7.0; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; ISH_BUNDLE_VERSION = 0; ISH_BUNDLE_VERSION_MAJOR = 2; ISH_BUNDLE_VERSION_MINOR = 0; @@ -868,7 +890,6 @@ FRAMEWORK_VERSION = "${ISH_BUNDLE_VERSION_SHORT}"; INFOPLIST_FILE = ISHPermissionKit/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "de.iosphere.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -888,7 +909,6 @@ FRAMEWORK_VERSION = "${ISH_BUNDLE_VERSION_SHORT}"; INFOPLIST_FILE = ISHPermissionKit/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "de.iosphere.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -900,7 +920,6 @@ isa = XCBuildConfiguration; buildSettings = { INFOPLIST_FILE = ISHPermissionKitTests/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; METAL_ENABLE_DEBUG_INFO = YES; OTHER_LDFLAGS = "-ObjC"; @@ -913,7 +932,6 @@ isa = XCBuildConfiguration; buildSettings = { INFOPLIST_FILE = ISHPermissionKitTests/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; METAL_ENABLE_DEBUG_INFO = NO; OTHER_LDFLAGS = "-ObjC"; diff --git a/ISHPermissionKit.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/ISHPermissionKit.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/ISHPermissionKit.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/ISHPermissionKit.xcodeproj/xcshareddata/xcschemes/ISHPermissionKit.xcscheme b/ISHPermissionKit.xcodeproj/xcshareddata/xcschemes/ISHPermissionKit.xcscheme index 00e5624..199c294 100644 --- a/ISHPermissionKit.xcodeproj/xcshareddata/xcschemes/ISHPermissionKit.xcscheme +++ b/ISHPermissionKit.xcodeproj/xcshareddata/xcschemes/ISHPermissionKit.xcscheme @@ -1,6 +1,6 @@ Date: Tue, 4 Sep 2018 18:21:55 +0200 Subject: [PATCH 2/8] Remove support for deprecated frameworks MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use ISHPermissionCategoryModernPhotoLibrary and ISHPermissionCategoryContacts instead – they are available on all supported deployment targets. --- ISHPermissionKit.podspec | 14 +-- ISHPermissionKit.xcodeproj/project.pbxproj | 24 ----- ISHPermissionKit/ISHPermissionCategory.h | 39 +------- .../Private/ISHPermissionRequestAddressBook.h | 21 ----- .../ISHPermissionRequestPhotoLibrary.h | 21 ----- .../Requests/ISHPermissionRequest+All.m | 9 -- .../ISHPermissionRequestAddressBook.m | 89 ------------------- .../ISHPermissionRequestPhotoLibrary.m | 61 ------------- ISHPermissionKitTests/ISHPermissionKitTests.m | 3 +- 9 files changed, 10 insertions(+), 271 deletions(-) delete mode 100644 ISHPermissionKit/Private/ISHPermissionRequestAddressBook.h delete mode 100644 ISHPermissionKit/Private/ISHPermissionRequestPhotoLibrary.h delete mode 100644 ISHPermissionKit/Requests/ISHPermissionRequestAddressBook.m delete mode 100644 ISHPermissionKit/Requests/ISHPermissionRequestPhotoLibrary.m diff --git a/ISHPermissionKit.podspec b/ISHPermissionKit.podspec index 7ec014c..2e27b99 100644 --- a/ISHPermissionKit.podspec +++ b/ISHPermissionKit.podspec @@ -1,20 +1,20 @@ Pod::Spec.new do |s| s.name = 'ISHPermissionKit' - s.version = '2.0.0' + s.version = '2.1.0' s.summary = 'A polite and unified way of asking for permission on iOS.' - s.description = 'This framework provides a unified way of asking for user permissions on iOS. It also + s.description = 'This framework provides a unified way of asking for user permissions on iOS. It also provides UI to explain the permission requirements before presenting the system - permission dialog to the user. This allows the developer to postpone the system dialog. The framework + permission dialog to the user. This allows the developer to postpone the system dialog. The framework provides no actual chrome, leaving the developer and designer in charge of creating the views.' s.homepage = 'https://github.com/iosphere/ISHPermissionKit.git' s.screenshots = 'https://raw.githubusercontent.com/iosphere/ISHPermissionKit/master/assets/demo.gif' - s.license = 'New BSD' + s.license = 'New BSD' s.authors = { 'Felix Lamouroux' => 'felix@iosphere.de' } - s.platform = :ios, '7.0' + s.platform = :ios, '9.0' s.source = { :git => 'https://github.com/iosphere/ISHPermissionKit.git', :tag => s.version.to_s } s.module_name = 'ISHPermissionKit' @@ -61,7 +61,7 @@ Pod::Spec.new do |s| s.subspec 'PhotoLibrary' do |photo| photo.dependency 'ISHPermissionKit/Core' - photo.weak_framework = 'Photos', 'AssetsLibrary' + photo.weak_framework = 'Photos' feature_flags = { 'GCC_PREPROCESSOR_DEFINITIONS' => 'ISHPermissionRequestPhotoLibraryEnabled' } photo.pod_target_xcconfig = feature_flags photo.user_target_xcconfig = feature_flags @@ -93,7 +93,7 @@ Pod::Spec.new do |s| s.subspec 'Contacts' do |contacts| contacts.dependency 'ISHPermissionKit/Core' - contacts.weak_framework = 'Contacts', 'AddressBook' + contacts.weak_framework = 'Contacts' feature_flags = { 'GCC_PREPROCESSOR_DEFINITIONS' => 'ISHPermissionRequestContactsEnabled' } contacts.pod_target_xcconfig = feature_flags contacts.user_target_xcconfig = feature_flags diff --git a/ISHPermissionKit.xcodeproj/project.pbxproj b/ISHPermissionKit.xcodeproj/project.pbxproj index 3c84940..08773c8 100644 --- a/ISHPermissionKit.xcodeproj/project.pbxproj +++ b/ISHPermissionKit.xcodeproj/project.pbxproj @@ -42,9 +42,6 @@ DC5E5BAE195D67500092EAFD /* ISHPermissionRequestMicrophone.h in Headers */ = {isa = PBXBuildFile; fileRef = DC5E5BAC195D67500092EAFD /* ISHPermissionRequestMicrophone.h */; }; DC5E5BAF195D67500092EAFD /* ISHPermissionRequestMicrophone.m in Sources */ = {isa = PBXBuildFile; fileRef = DC5E5BAD195D67500092EAFD /* ISHPermissionRequestMicrophone.m */; }; DC5E5BB0195D67500092EAFD /* ISHPermissionRequestMicrophone.m in Sources */ = {isa = PBXBuildFile; fileRef = DC5E5BAD195D67500092EAFD /* ISHPermissionRequestMicrophone.m */; }; - DC5E5BB3195D6E890092EAFD /* ISHPermissionRequestPhotoLibrary.h in Headers */ = {isa = PBXBuildFile; fileRef = DC5E5BB1195D6E890092EAFD /* ISHPermissionRequestPhotoLibrary.h */; }; - DC5E5BB4195D6E890092EAFD /* ISHPermissionRequestPhotoLibrary.m in Sources */ = {isa = PBXBuildFile; fileRef = DC5E5BB2195D6E890092EAFD /* ISHPermissionRequestPhotoLibrary.m */; }; - DC5E5BB5195D6E890092EAFD /* ISHPermissionRequestPhotoLibrary.m in Sources */ = {isa = PBXBuildFile; fileRef = DC5E5BB2195D6E890092EAFD /* ISHPermissionRequestPhotoLibrary.m */; }; DC5E5BB8195D78800092EAFD /* ISHPermissionRequestPhotoCamera.h in Headers */ = {isa = PBXBuildFile; fileRef = DC5E5BB6195D78800092EAFD /* ISHPermissionRequestPhotoCamera.h */; }; DC5E5BB9195D78800092EAFD /* ISHPermissionRequestPhotoCamera.m in Sources */ = {isa = PBXBuildFile; fileRef = DC5E5BB7195D78800092EAFD /* ISHPermissionRequestPhotoCamera.m */; }; DC5E5BBA195D78800092EAFD /* ISHPermissionRequestPhotoCamera.m in Sources */ = {isa = PBXBuildFile; fileRef = DC5E5BB7195D78800092EAFD /* ISHPermissionRequestPhotoCamera.m */; }; @@ -68,11 +65,6 @@ DC6A8A8A19633180005AC5BD /* ISHPermissionRequestMotion.h in Headers */ = {isa = PBXBuildFile; fileRef = DCAEF7BF195C5B6B0074EB5B /* ISHPermissionRequestMotion.h */; }; DC6A8A8B19633180005AC5BD /* ISHPermissionRequestNotificationsLocal.h in Headers */ = {isa = PBXBuildFile; fileRef = DC5E5BC1195DAD750092EAFD /* ISHPermissionRequestNotificationsLocal.h */; settings = {ATTRIBUTES = (Public, ); }; }; DC6A8A8C19633180005AC5BD /* ISHPermissionRequestPhotoCamera.h in Headers */ = {isa = PBXBuildFile; fileRef = DC5E5BB6195D78800092EAFD /* ISHPermissionRequestPhotoCamera.h */; }; - DC6A8A8D19633180005AC5BD /* ISHPermissionRequestPhotoLibrary.h in Headers */ = {isa = PBXBuildFile; fileRef = DC5E5BB1195D6E890092EAFD /* ISHPermissionRequestPhotoLibrary.h */; }; - DC6A8ACD19641549005AC5BD /* ISHPermissionRequestAddressBook.h in Headers */ = {isa = PBXBuildFile; fileRef = DC6A8ACB19641549005AC5BD /* ISHPermissionRequestAddressBook.h */; }; - DC6A8ACE19641549005AC5BD /* ISHPermissionRequestAddressBook.h in Headers */ = {isa = PBXBuildFile; fileRef = DC6A8ACB19641549005AC5BD /* ISHPermissionRequestAddressBook.h */; }; - DC6A8ACF19641549005AC5BD /* ISHPermissionRequestAddressBook.m in Sources */ = {isa = PBXBuildFile; fileRef = DC6A8ACC19641549005AC5BD /* ISHPermissionRequestAddressBook.m */; }; - DC6A8AD019641549005AC5BD /* ISHPermissionRequestAddressBook.m in Sources */ = {isa = PBXBuildFile; fileRef = DC6A8ACC19641549005AC5BD /* ISHPermissionRequestAddressBook.m */; }; DC6A8AD319642793005AC5BD /* ISHPermissionRequestEventStore.h in Headers */ = {isa = PBXBuildFile; fileRef = DC6A8AD119642793005AC5BD /* ISHPermissionRequestEventStore.h */; }; DC6A8AD419642793005AC5BD /* ISHPermissionRequestEventStore.h in Headers */ = {isa = PBXBuildFile; fileRef = DC6A8AD119642793005AC5BD /* ISHPermissionRequestEventStore.h */; }; DC6A8AD519642793005AC5BD /* ISHPermissionRequestEventStore.m in Sources */ = {isa = PBXBuildFile; fileRef = DC6A8AD219642793005AC5BD /* ISHPermissionRequestEventStore.m */; }; @@ -157,15 +149,11 @@ DC1A80AF195B2C960069235F /* ISHPermissionRequestViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ISHPermissionRequestViewController.m; sourceTree = ""; }; DC5E5BAC195D67500092EAFD /* ISHPermissionRequestMicrophone.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ISHPermissionRequestMicrophone.h; path = ../Private/ISHPermissionRequestMicrophone.h; sourceTree = ""; }; DC5E5BAD195D67500092EAFD /* ISHPermissionRequestMicrophone.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ISHPermissionRequestMicrophone.m; sourceTree = ""; }; - DC5E5BB1195D6E890092EAFD /* ISHPermissionRequestPhotoLibrary.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ISHPermissionRequestPhotoLibrary.h; path = ../Private/ISHPermissionRequestPhotoLibrary.h; sourceTree = ""; }; - DC5E5BB2195D6E890092EAFD /* ISHPermissionRequestPhotoLibrary.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ISHPermissionRequestPhotoLibrary.m; sourceTree = ""; }; DC5E5BB6195D78800092EAFD /* ISHPermissionRequestPhotoCamera.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ISHPermissionRequestPhotoCamera.h; path = ../Private/ISHPermissionRequestPhotoCamera.h; sourceTree = ""; }; DC5E5BB7195D78800092EAFD /* ISHPermissionRequestPhotoCamera.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ISHPermissionRequestPhotoCamera.m; sourceTree = ""; }; DC5E5BC1195DAD750092EAFD /* ISHPermissionRequestNotificationsLocal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ISHPermissionRequestNotificationsLocal.h; sourceTree = ""; }; DC5E5BC2195DAD750092EAFD /* ISHPermissionRequestNotificationsLocal.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ISHPermissionRequestNotificationsLocal.m; sourceTree = ""; }; DC5E5BC6195DC1F30092EAFD /* ISHPermissionRequest+Private.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "ISHPermissionRequest+Private.h"; path = "../Private/ISHPermissionRequest+Private.h"; sourceTree = ""; }; - DC6A8ACB19641549005AC5BD /* ISHPermissionRequestAddressBook.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ISHPermissionRequestAddressBook.h; path = ../Private/ISHPermissionRequestAddressBook.h; sourceTree = ""; }; - DC6A8ACC19641549005AC5BD /* ISHPermissionRequestAddressBook.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ISHPermissionRequestAddressBook.m; sourceTree = ""; }; DC6A8AD119642793005AC5BD /* ISHPermissionRequestEventStore.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ISHPermissionRequestEventStore.h; path = ../Private/ISHPermissionRequestEventStore.h; sourceTree = ""; }; DC6A8AD219642793005AC5BD /* ISHPermissionRequestEventStore.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ISHPermissionRequestEventStore.m; sourceTree = ""; }; DC7790B619617CD7007CB2BC /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; @@ -253,8 +241,6 @@ DC5E5BC6195DC1F30092EAFD /* ISHPermissionRequest+Private.h */, DCD56C761962AEDC00508F4A /* ISHPermissionRequestAccount.h */, DCD56C771962AEDC00508F4A /* ISHPermissionRequestAccount.m */, - DC6A8ACB19641549005AC5BD /* ISHPermissionRequestAddressBook.h */, - DC6A8ACC19641549005AC5BD /* ISHPermissionRequestAddressBook.m */, 1B09324B1D7069D90095A74A /* ISHPermissionRequestContacts.h */, 1B0932481D7069C70095A74A /* ISHPermissionRequestContacts.m */, DC6A8AD119642793005AC5BD /* ISHPermissionRequestEventStore.h */, @@ -277,8 +263,6 @@ DC96E8CD1B95CAAD0019E958 /* ISHPermissionRequestNotificationsRemote.m */, DC5E5BB6195D78800092EAFD /* ISHPermissionRequestPhotoCamera.h */, DC5E5BB7195D78800092EAFD /* ISHPermissionRequestPhotoCamera.m */, - DC5E5BB1195D6E890092EAFD /* ISHPermissionRequestPhotoLibrary.h */, - DC5E5BB2195D6E890092EAFD /* ISHPermissionRequestPhotoLibrary.m */, 1B4513041D6DC02D00D6E47C /* ISHPermissionRequestSiri.h */, 1B4512FB1D6DC01200D6E47C /* ISHPermissionRequestSiri.m */, 1B96D5FF1D6F12CF0026A4FC /* ISHPermissionRequestSpeechRecognition.h */, @@ -366,7 +350,6 @@ isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; files = ( - DC6A8ACE19641549005AC5BD /* ISHPermissionRequestAddressBook.h in Headers */, DC6A8A7E19633180005AC5BD /* ISHPermissionKit.h in Headers */, DC6A8A8419633180005AC5BD /* ISHPermissionRequest+All.h in Headers */, 1B09324D1D7069D90095A74A /* ISHPermissionRequestContacts.h in Headers */, @@ -390,7 +373,6 @@ 1B96D6011D6F12CF0026A4FC /* ISHPermissionRequestSpeechRecognition.h in Headers */, DC6A8A8A19633180005AC5BD /* ISHPermissionRequestMotion.h in Headers */, DC6A8A8C19633180005AC5BD /* ISHPermissionRequestPhotoCamera.h in Headers */, - DC6A8A8D19633180005AC5BD /* ISHPermissionRequestPhotoLibrary.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -398,13 +380,11 @@ isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; files = ( - DC6A8ACD19641549005AC5BD /* ISHPermissionRequestAddressBook.h in Headers */, DC799EC4195C19CD00A0CA36 /* ISHPermissionRequest+All.h in Headers */, DCC1BFAB195B174200362559 /* ISHPermissionKit.h in Headers */, DC1A80A3195B21DC0069235F /* ISHPermissionsViewController.h in Headers */, DC1A80B0195B2C960069235F /* ISHPermissionRequestViewController.h in Headers */, 1B09324C1D7069D90095A74A /* ISHPermissionRequestContacts.h in Headers */, - DC5E5BB3195D6E890092EAFD /* ISHPermissionRequestPhotoLibrary.h in Headers */, DC5E5BAE195D67500092EAFD /* ISHPermissionRequestMicrophone.h in Headers */, DCD56C781962AEDC00508F4A /* ISHPermissionRequestAccount.h in Headers */, 1B69884B1D6F40F400C8EAB8 /* ISHPermissionRequestUserNotification.h in Headers */, @@ -547,14 +527,12 @@ buildActionMask = 2147483647; files = ( DC5E5BC5195DAD770092EAFD /* ISHPermissionRequestNotificationsLocal.m in Sources */, - DC6A8AD019641549005AC5BD /* ISHPermissionRequestAddressBook.m in Sources */, 1B4513011D6DC01200D6E47C /* ISHPermissionRequestSiri.m in Sources */, DC5E5BBA195D78800092EAFD /* ISHPermissionRequestPhotoCamera.m in Sources */, DCAEF7E5195C60250074EB5B /* ISHPermissionRequestLocation.m in Sources */, 1B63F8991D6DF5F200B14122 /* ISHPermissionRequestModernPhotoLibrary.m in Sources */, DCD56C7F1962BB8600508F4A /* ISHPermissionRequestHealth.m in Sources */, DCAEF7E1195C60250074EB5B /* ISHPermissionRequestViewController.m in Sources */, - DC5E5BB5195D6E890092EAFD /* ISHPermissionRequestPhotoLibrary.m in Sources */, 1BC93E4F1D7063D20033B6E8 /* ISHPermissionRequestMusicLibrary.m in Sources */, DCAEF7E6195C60250074EB5B /* ISHPermissionRequestMotion.m in Sources */, DC5E5BB0195D67500092EAFD /* ISHPermissionRequestMicrophone.m in Sources */, @@ -575,14 +553,12 @@ buildActionMask = 2147483647; files = ( DC5E5BC4195DAD750092EAFD /* ISHPermissionRequestNotificationsLocal.m in Sources */, - DC6A8ACF19641549005AC5BD /* ISHPermissionRequestAddressBook.m in Sources */, 1B4513001D6DC01200D6E47C /* ISHPermissionRequestSiri.m in Sources */, DC5E5BB9195D78800092EAFD /* ISHPermissionRequestPhotoCamera.m in Sources */, DC799EC5195C19CD00A0CA36 /* ISHPermissionRequest+All.m in Sources */, 1B63F8981D6DF5F200B14122 /* ISHPermissionRequestModernPhotoLibrary.m in Sources */, DCD56C7E1962BB8600508F4A /* ISHPermissionRequestHealth.m in Sources */, DCAEF7C2195C5B6B0074EB5B /* ISHPermissionRequestMotion.m in Sources */, - DC5E5BB4195D6E890092EAFD /* ISHPermissionRequestPhotoLibrary.m in Sources */, 1BC93E4E1D7063D20033B6E8 /* ISHPermissionRequestMusicLibrary.m in Sources */, DC799EC0195C186100A0CA36 /* ISHPermissionRequestLocation.m in Sources */, DC5E5BAF195D67500092EAFD /* ISHPermissionRequestMicrophone.m in Sources */, diff --git a/ISHPermissionKit/ISHPermissionCategory.h b/ISHPermissionKit/ISHPermissionCategory.h index 21a1f59..1c080c6 100644 --- a/ISHPermissionKit/ISHPermissionCategory.h +++ b/ISHPermissionKit/ISHPermissionCategory.h @@ -116,22 +116,6 @@ typedef NS_ENUM(NSUInteger, ISHPermissionCategory) { #endif #ifdef ISHPermissionRequestPhotoLibraryEnabled - /** - * Permission required to access the user's photo library. - * - * Deprecated from iOS 9 as it uses ALAssetsLibrary - * internally. - * - * The app must also provide a localized NSPhotoLibraryUsageDescription - * in the Info PLIST. - * - * To enable this category, you must set the preprocessor flag - * ISHPermissionRequestPhotoLibraryEnabled. This will link the - * AssetsLibrary and Photos frameworks. - * - * @sa ISHPermissionCategoryModernPhotoLibrary - */ - ISHPermissionCategoryPhotoLibrary NS_ENUM_DEPRECATED_IOS(7.0, 9.0, "Use ISHPermissionCategoryModernPhotoLibrary") = 5000, /** * Permission required to access the user's photo library. * @@ -142,7 +126,7 @@ typedef NS_ENUM(NSUInteger, ISHPermissionCategory) { * * To enable this category, you must set the preprocessor flag * ISHPermissionRequestPhotoLibraryEnabled. This will link the - * AssetsLibrary and Photos frameworks. + * Photos frameworks. */ ISHPermissionCategoryModernPhotoLibrary NS_ENUM_AVAILABLE_IOS(8_0) = 5050, #endif @@ -253,21 +237,6 @@ typedef NS_ENUM(NSUInteger, ISHPermissionCategory) { #endif #ifdef ISHPermissionRequestContactsEnabled - /** - * Permission required to access the user's contacts. - * - * The app must also provide a localized NSContactsUsageDescription - * in the Info PLIST. Please consult the app review guidelines for - * special requirements for apps that access contacts, specifically - * section 5.1 (Privacy). - * - * To enable this category, you must set the preprocessor flag - * ISHPermissionRequestContactsEnabled. This will link the Contacts - * and AddressBook frameworks. - * - * @sa ISHPermissionCategoryContacts - */ - ISHPermissionCategoryAddressBook NS_ENUM_DEPRECATED_IOS(7.0, 9.0, "Use ISHPermissionCategoryContacts") = 8100, /** * Permission required to access the user's contacts on modern * systems, using the Contacts framework. @@ -279,7 +248,7 @@ typedef NS_ENUM(NSUInteger, ISHPermissionCategory) { * * To enable this category, you must set the preprocessor flag * ISHPermissionRequestContactsEnabled. This will link the Contacts - * and AddressBook frameworks. + * framework. */ ISHPermissionCategoryContacts NS_ENUM_AVAILABLE_IOS(9_0) = 8500, #endif @@ -417,8 +386,6 @@ static inline NSString * _Nonnull ISHStringFromPermissionCategory(ISHPermissionC #endif #ifdef ISHPermissionRequestPhotoLibraryEnabled - case ISHPermissionCategoryPhotoLibrary: - return @"ISHPermissionCategoryPhotoLibrary"; case ISHPermissionCategoryModernPhotoLibrary: return @"ISHPermissionCategoryModernPhotoLibrary"; #endif @@ -447,8 +414,6 @@ static inline NSString * _Nonnull ISHStringFromPermissionCategory(ISHPermissionC #endif #ifdef ISHPermissionRequestContactsEnabled - case ISHPermissionCategoryAddressBook: - return @"ISHPermissionCategoryAddressBook"; case ISHPermissionCategoryContacts: return @"ISHPermissionCategoryContacts"; #endif diff --git a/ISHPermissionKit/Private/ISHPermissionRequestAddressBook.h b/ISHPermissionKit/Private/ISHPermissionRequestAddressBook.h deleted file mode 100644 index 7b85435..0000000 --- a/ISHPermissionKit/Private/ISHPermissionRequestAddressBook.h +++ /dev/null @@ -1,21 +0,0 @@ -// -// ISHPermissionRequestAddressBook.h -// ISHPermissionKit -// -// Created by Felix Lamouroux on 02.07.14. -// Copyright (c) 2014 iosphere GmbH. All rights reserved. -// - -#import "ISHPermissionRequest.h" - -#ifdef ISHPermissionRequestContactsEnabled - -/** - * Permission request for the user's address book. - * - * @sa ISHPermissionCategoryAddressBook - */ -@interface ISHPermissionRequestAddressBook : ISHPermissionRequest -@end - -#endif diff --git a/ISHPermissionKit/Private/ISHPermissionRequestPhotoLibrary.h b/ISHPermissionKit/Private/ISHPermissionRequestPhotoLibrary.h deleted file mode 100644 index ca0c24c..0000000 --- a/ISHPermissionKit/Private/ISHPermissionRequestPhotoLibrary.h +++ /dev/null @@ -1,21 +0,0 @@ -// -// ISHPermissionRequestPhotoLibrary.h -// ISHPermissionKit -// -// Created by Felix Lamouroux on 27.06.14. -// Copyright (c) 2014 iosphere GmbH. All rights reserved. -// - -#import "ISHPermissionRequest.h" - -#ifdef ISHPermissionRequestPhotoLibraryEnabled - -/** - * Permission request to access the user's photo library. - * - * @sa ISHPermissionCategoryPhotoLibrary - */ -@interface ISHPermissionRequestPhotoLibrary : ISHPermissionRequest -@end - -#endif diff --git a/ISHPermissionKit/Requests/ISHPermissionRequest+All.m b/ISHPermissionKit/Requests/ISHPermissionRequest+All.m index 51eff71..63e9189 100644 --- a/ISHPermissionKit/Requests/ISHPermissionRequest+All.m +++ b/ISHPermissionKit/Requests/ISHPermissionRequest+All.m @@ -10,7 +10,6 @@ #import "ISHPermissionRequestLocation.h" #import "ISHPermissionRequestMotion.h" #import "ISHPermissionRequestMicrophone.h" -#import "ISHPermissionRequestPhotoLibrary.h" #import "ISHPermissionRequestModernPhotoLibrary.h" #import "ISHPermissionRequestPhotoCamera.h" #import "ISHPermissionRequestNotificationsLocal.h" @@ -18,7 +17,6 @@ #import "ISHPermissionRequestUserNotification.h" #import "ISHPermissionRequestAccount.h" #import "ISHPermissionRequestHealth.h" -#import "ISHPermissionRequestAddressBook.h" #import "ISHPermissionRequestContacts.h" #import "ISHPermissionRequestEventStore.h" #import "ISHPermissionRequest+Private.h" @@ -62,10 +60,6 @@ + (ISHPermissionRequest *)requestForCategory:(ISHPermissionCategory)category { #endif #ifdef ISHPermissionRequestPhotoLibraryEnabled - case ISHPermissionCategoryPhotoLibrary: - request = [ISHPermissionRequestPhotoLibrary new]; - break; - case ISHPermissionCategoryModernPhotoLibrary: request = [ISHPermissionRequestModernPhotoLibrary new]; break; @@ -97,9 +91,6 @@ + (ISHPermissionRequest *)requestForCategory:(ISHPermissionCategory)category { #endif #ifdef ISHPermissionRequestContactsEnabled - case ISHPermissionCategoryAddressBook: - request = [ISHPermissionRequestAddressBook new]; - break; case ISHPermissionCategoryContacts: request = [ISHPermissionRequestContacts new]; break; diff --git a/ISHPermissionKit/Requests/ISHPermissionRequestAddressBook.m b/ISHPermissionKit/Requests/ISHPermissionRequestAddressBook.m deleted file mode 100644 index 98d2f2d..0000000 --- a/ISHPermissionKit/Requests/ISHPermissionRequestAddressBook.m +++ /dev/null @@ -1,89 +0,0 @@ -// -// ISHPermissionRequestAddressBook.m -// ISHPermissionKit -// -// Created by Felix Lamouroux on 02.07.14. -// Copyright (c) 2014 iosphere GmbH. All rights reserved. -// - -#import "ISHPermissionRequestAddressBook.h" -#import "ISHPermissionRequest+Private.h" - -#ifdef ISHPermissionRequestContactsEnabled - -@import AddressBook; - -@implementation ISHPermissionRequestAddressBook { - ABAddressBookRef _addressBook; -} - -- (ISHPermissionState)permissionState { - ABAuthorizationStatus status = ABAddressBookGetAuthorizationStatus(); - - switch (status) { - case kABAuthorizationStatusAuthorized: - return ISHPermissionStateAuthorized; - - case kABAuthorizationStatusRestricted: - case kABAuthorizationStatusDenied: - return ISHPermissionStateDenied; - - case kABAuthorizationStatusNotDetermined: - return [self internalPermissionState]; - } -} - -- (void)requestUserPermissionWithCompletionBlock:(ISHPermissionRequestCompletionBlock)completion { - if (![self mayRequestUserPermissionWithCompletionBlock:completion]) { - return; - } - - ABAddressBookRequestAccessWithCompletion(self.addressBook, ^(bool granted, CFErrorRef error) { - dispatch_async(dispatch_get_main_queue(), ^{ - completion(self, granted ? ISHPermissionStateAuthorized : ISHPermissionStateDenied, (__bridge NSError *)(error)); - }); - }); -} - -- (ABAddressBookRef)addressBook { - if (!_addressBook) { - ABAddressBookRef addressBook = ABAddressBookCreateWithOptions(NULL, NULL); - - if (addressBook) { - [self setAddressBook:CFAutorelease(addressBook)]; - } - } - - return _addressBook; -} - -- (void)setAddressBook:(ABAddressBookRef)newAddressBook { - if (_addressBook != newAddressBook) { - if (_addressBook) { - CFRelease(_addressBook); - } - - if (newAddressBook) { - CFRetain(newAddressBook); - } - - _addressBook = newAddressBook; - } -} - -- (void)dealloc { - if (_addressBook) { - CFRelease(_addressBook); - _addressBook = NULL; - } -} - -#if DEBUG -- (NSArray *)staticUsageDescriptionKeys { - return @[@"NSContactsUsageDescription"]; -} -#endif - -@end - -#endif diff --git a/ISHPermissionKit/Requests/ISHPermissionRequestPhotoLibrary.m b/ISHPermissionKit/Requests/ISHPermissionRequestPhotoLibrary.m deleted file mode 100644 index f23869b..0000000 --- a/ISHPermissionKit/Requests/ISHPermissionRequestPhotoLibrary.m +++ /dev/null @@ -1,61 +0,0 @@ -// -// ISHPermissionRequestPhotoLibrary.m -// ISHPermissionKit -// -// Created by Felix Lamouroux on 27.06.14. -// Copyright (c) 2014 iosphere GmbH. All rights reserved. -// - -#import "ISHPermissionRequestPhotoLibrary.h" -#import "ISHPermissionRequest+Private.h" - -#ifdef ISHPermissionRequestPhotoLibraryEnabled - -@import AssetsLibrary; - -@implementation ISHPermissionRequestPhotoLibrary - -- (ISHPermissionState)permissionState { - ALAuthorizationStatus systemState = [ALAssetsLibrary authorizationStatus]; - switch (systemState) { - case ALAuthorizationStatusAuthorized: - return ISHPermissionStateAuthorized; - case ALAuthorizationStatusDenied: - case ALAuthorizationStatusRestricted: - return ISHPermissionStateDenied; - default: - return [self internalPermissionState]; - } -} - -- (void)requestUserPermissionWithCompletionBlock:(ISHPermissionRequestCompletionBlock)completion { - if (![self mayRequestUserPermissionWithCompletionBlock:completion]) { - return; - } - - ALAssetsLibrary *assetsLibrary = [ALAssetsLibrary new]; - [assetsLibrary enumerateGroupsWithTypes:ALAssetsGroupSavedPhotos usingBlock:^(ALAssetsGroup *group, BOOL *stop) { - if (!group) { - // ensure that completion is only called once - dispatch_async(dispatch_get_main_queue(), ^{ - completion(self, self.permissionState, nil); - *stop = YES; - }); - } - } failureBlock:^(NSError *error) { - NSError *externalError = [ISHPermissionRequest externalErrorForError:error validationDomain:ALAssetsLibraryErrorDomain denialCodes:[NSSet setWithObject:@(ALAssetsLibraryAccessUserDeniedError)]]; - dispatch_async(dispatch_get_main_queue(), ^{ - completion(self, self.permissionState, externalError); - }); - }]; -} - -#if DEBUG -- (NSArray *)staticUsageDescriptionKeyss { - return @[@"NSPhotoLibraryUsageDescription"]; -} -#endif - -@end - -#endif diff --git a/ISHPermissionKitTests/ISHPermissionKitTests.m b/ISHPermissionKitTests/ISHPermissionKitTests.m index 6c8a825..4d6434b 100644 --- a/ISHPermissionKitTests/ISHPermissionKitTests.m +++ b/ISHPermissionKitTests/ISHPermissionKitTests.m @@ -23,7 +23,7 @@ - (void)testNonNilRequests { @(ISHPermissionCategoryLocationAlways), @(ISHPermissionCategoryLocationWhenInUse), @(ISHPermissionCategoryMicrophone), - @(ISHPermissionCategoryPhotoLibrary), + @(ISHPermissionCategoryModernPhotoLibrary), @(ISHPermissionCategoryPhotoCamera), @(ISHPermissionCategoryNotificationLocal), @(ISHPermissionCategoryNotificationRemote), @@ -31,7 +31,6 @@ - (void)testNonNilRequests { @(ISHPermissionCategorySocialTwitter), @(ISHPermissionCategorySocialSinaWeibo), @(ISHPermissionCategorySocialTencentWeibo), - @(ISHPermissionCategoryAddressBook), @(ISHPermissionCategoryEvents), @(ISHPermissionCategoryReminders), ]; From 7d323a9f5d5f879505aff883eccdfe4d87c71256 Mon Sep 17 00:00:00 2001 From: Sebastian Hagedorn Date: Tue, 4 Sep 2018 18:42:14 +0200 Subject: [PATCH 3/8] Remove support for Xcode 8 --- ISHPermissionKit/ISHPermissionCategory.h | 5 ----- ISHPermissionKit/Private/ISHPermissionRequestSiri.h | 2 -- .../Private/ISHPermissionRequestSpeechRecognition.h | 2 -- ISHPermissionKit/Requests/ISHPermissionRequest+All.m | 2 -- .../Requests/ISHPermissionRequestNotificationsLocal.m | 2 -- ISHPermissionKit/Requests/ISHPermissionRequestSiri.m | 2 -- .../Requests/ISHPermissionRequestSpeechRecognition.m | 2 -- .../Requests/ISHPermissionRequestUserNotification.h | 2 -- .../Requests/ISHPermissionRequestUserNotification.m | 2 -- 9 files changed, 21 deletions(-) diff --git a/ISHPermissionKit/ISHPermissionCategory.h b/ISHPermissionKit/ISHPermissionCategory.h index 1c080c6..0f06939 100644 --- a/ISHPermissionKit/ISHPermissionCategory.h +++ b/ISHPermissionKit/ISHPermissionCategory.h @@ -283,8 +283,6 @@ typedef NS_ENUM(NSUInteger, ISHPermissionCategory) { ISHPermissionCategoryReminders = 8250, #endif -// These categories requires Xcode 8/iOS 10 SDK -#ifdef NSFoundationVersionNumber_iOS_9_0 #ifdef ISHPermissionRequestSiriEnabled /** * Permission required for Siri to access your app's data. @@ -338,7 +336,6 @@ typedef NS_ENUM(NSUInteger, ISHPermissionCategory) { */ ISHPermissionCategoryUserNotification NS_ENUM_AVAILABLE_IOS(10_0) = 6500, #endif -#endif #ifdef ISHPermissionRequestMusicLibraryEnabled /** @@ -433,7 +430,6 @@ static inline NSString * _Nonnull ISHStringFromPermissionCategory(ISHPermissionC return @"ISHPermissionCategoryMusicLibrary"; #endif -#ifdef NSFoundationVersionNumber_iOS_9_0 #ifdef ISHPermissionRequestSiriEnabled case ISHPermissionCategorySiri: return @"ISHPermissionCategorySiri"; @@ -447,7 +443,6 @@ static inline NSString * _Nonnull ISHStringFromPermissionCategory(ISHPermissionC #ifdef ISHPermissionRequestNotificationsEnabled case ISHPermissionCategoryUserNotification: return @"ISHPermissionCategoryUserNotification"; -#endif #endif case ISHPermissionCategoryInvalid: diff --git a/ISHPermissionKit/Private/ISHPermissionRequestSiri.h b/ISHPermissionKit/Private/ISHPermissionRequestSiri.h index 904f56f..5878234 100644 --- a/ISHPermissionKit/Private/ISHPermissionRequestSiri.h +++ b/ISHPermissionKit/Private/ISHPermissionRequestSiri.h @@ -9,7 +9,6 @@ #import "ISHPermissionRequest.h" #ifdef ISHPermissionRequestSiriEnabled -#ifdef NSFoundationVersionNumber_iOS_9_0 /** * Permission request for Siri to access your app's data. @@ -21,4 +20,3 @@ @end #endif -#endif diff --git a/ISHPermissionKit/Private/ISHPermissionRequestSpeechRecognition.h b/ISHPermissionKit/Private/ISHPermissionRequestSpeechRecognition.h index 0113926..a739e0f 100644 --- a/ISHPermissionKit/Private/ISHPermissionRequestSpeechRecognition.h +++ b/ISHPermissionKit/Private/ISHPermissionRequestSpeechRecognition.h @@ -9,7 +9,6 @@ #import "ISHPermissionRequest.h" #ifdef ISHPermissionRequestSpeechEnabled -#ifdef NSFoundationVersionNumber_iOS_9_0 /** * Permission request to acces the speech recognition @@ -22,4 +21,3 @@ @end #endif -#endif diff --git a/ISHPermissionKit/Requests/ISHPermissionRequest+All.m b/ISHPermissionKit/Requests/ISHPermissionRequest+All.m index 63e9189..c5108ce 100644 --- a/ISHPermissionKit/Requests/ISHPermissionRequest+All.m +++ b/ISHPermissionKit/Requests/ISHPermissionRequest+All.m @@ -114,7 +114,6 @@ + (ISHPermissionRequest *)requestForCategory:(ISHPermissionCategory)category { break; #endif -#ifdef NSFoundationVersionNumber_iOS_9_0 #ifdef ISHPermissionRequestSiriEnabled case ISHPermissionCategorySiri: request = [ISHPermissionRequestSiri new]; @@ -131,7 +130,6 @@ + (ISHPermissionRequest *)requestForCategory:(ISHPermissionCategory)category { case ISHPermissionCategoryUserNotification: request = [ISHPermissionRequestUserNotification new]; break; -#endif #endif case ISHPermissionCategoryInvalid: diff --git a/ISHPermissionKit/Requests/ISHPermissionRequestNotificationsLocal.m b/ISHPermissionKit/Requests/ISHPermissionRequestNotificationsLocal.m index 716420c..2521733 100644 --- a/ISHPermissionKit/Requests/ISHPermissionRequestNotificationsLocal.m +++ b/ISHPermissionKit/Requests/ISHPermissionRequestNotificationsLocal.m @@ -87,11 +87,9 @@ - (void)ISHPermissionNotificationApplicationDidRegisterUserNotificationSettings: }); } -#ifdef NSFoundationVersionNumber_iOS_9_0 // we also load a new instance of the related user notification so it can update // its internal state __unused id modernPermission = [[ISHPermissionRequestUserNotification alloc] init]; -#endif } @end diff --git a/ISHPermissionKit/Requests/ISHPermissionRequestSiri.m b/ISHPermissionKit/Requests/ISHPermissionRequestSiri.m index df3e3a5..a63720a 100644 --- a/ISHPermissionKit/Requests/ISHPermissionRequestSiri.m +++ b/ISHPermissionKit/Requests/ISHPermissionRequestSiri.m @@ -10,7 +10,6 @@ #import "ISHPermissionRequest+Private.h" #ifdef ISHPermissionRequestSiriEnabled -#ifdef NSFoundationVersionNumber_iOS_9_0 @import Intents; @@ -70,4 +69,3 @@ - (void)requestUserPermissionWithCompletionBlock:(ISHPermissionRequestCompletion @end #endif -#endif diff --git a/ISHPermissionKit/Requests/ISHPermissionRequestSpeechRecognition.m b/ISHPermissionKit/Requests/ISHPermissionRequestSpeechRecognition.m index c38ae9d..df4e701 100644 --- a/ISHPermissionKit/Requests/ISHPermissionRequestSpeechRecognition.m +++ b/ISHPermissionKit/Requests/ISHPermissionRequestSpeechRecognition.m @@ -10,7 +10,6 @@ #import "ISHPermissionRequest+Private.h" #ifdef ISHPermissionRequestSpeechEnabled -#ifdef NSFoundationVersionNumber_iOS_9_0 @import Speech; @@ -70,4 +69,3 @@ - (void)requestUserPermissionWithCompletionBlock:(ISHPermissionRequestCompletion @end #endif -#endif diff --git a/ISHPermissionKit/Requests/ISHPermissionRequestUserNotification.h b/ISHPermissionKit/Requests/ISHPermissionRequestUserNotification.h index b491a1f..6da6be9 100644 --- a/ISHPermissionKit/Requests/ISHPermissionRequestUserNotification.h +++ b/ISHPermissionKit/Requests/ISHPermissionRequestUserNotification.h @@ -9,7 +9,6 @@ #import "ISHPermissionRequest.h" #ifdef ISHPermissionRequestNotificationsEnabled -#ifdef NSFoundationVersionNumber_iOS_9_0 #import @@ -44,4 +43,3 @@ @end #endif -#endif diff --git a/ISHPermissionKit/Requests/ISHPermissionRequestUserNotification.m b/ISHPermissionKit/Requests/ISHPermissionRequestUserNotification.m index a16365d..963ae35 100644 --- a/ISHPermissionKit/Requests/ISHPermissionRequestUserNotification.m +++ b/ISHPermissionKit/Requests/ISHPermissionRequestUserNotification.m @@ -10,7 +10,6 @@ #import "ISHPermissionRequest+Private.h" #ifdef ISHPermissionRequestNotificationsEnabled -#ifdef NSFoundationVersionNumber_iOS_9_0 @import UIKit; @@ -106,4 +105,3 @@ - (void)requestUserPermissionWithCompletionBlock:(ISHPermissionRequestCompletion @end #endif -#endif From 791d0dbe01fbb8b1e9a7381c99d7527e6d284f99 Mon Sep 17 00:00:00 2001 From: Sebastian Hagedorn Date: Tue, 4 Sep 2018 18:55:48 +0200 Subject: [PATCH 4/8] Resolve notification center authorization warning Also minor code cleanup --- .../ISHPermissionRequestNotificationsLocal.m | 4 ---- .../ISHPermissionRequestNotificationsRemote.m | 12 ------------ .../Requests/ISHPermissionRequestUserNotification.h | 2 +- .../Requests/ISHPermissionRequestUserNotification.m | 6 +----- 4 files changed, 2 insertions(+), 22 deletions(-) diff --git a/ISHPermissionKit/Requests/ISHPermissionRequestNotificationsLocal.m b/ISHPermissionKit/Requests/ISHPermissionRequestNotificationsLocal.m index 2521733..d2bd9e2 100644 --- a/ISHPermissionKit/Requests/ISHPermissionRequestNotificationsLocal.m +++ b/ISHPermissionKit/Requests/ISHPermissionRequestNotificationsLocal.m @@ -38,10 +38,6 @@ - (void)dealloc { } - (ISHPermissionState)permissionState { - if (![UIUserNotificationSettings class]) { - return ISHPermissionStateAuthorized; - } - UIUserNotificationSettings *noticationSettings = [[UIApplication sharedApplication] currentUserNotificationSettings]; if (!noticationSettings || (noticationSettings.types == UIUserNotificationTypeNone)) { diff --git a/ISHPermissionKit/Requests/ISHPermissionRequestNotificationsRemote.m b/ISHPermissionKit/Requests/ISHPermissionRequestNotificationsRemote.m index 15b6ab7..60db84b 100644 --- a/ISHPermissionKit/Requests/ISHPermissionRequestNotificationsRemote.m +++ b/ISHPermissionKit/Requests/ISHPermissionRequestNotificationsRemote.m @@ -7,22 +7,10 @@ // #import "ISHPermissionRequestNotificationsRemote.h" -#import "ISHPermissionRequest+Private.h" #ifdef ISHPermissionRequestNotificationsEnabled -@import UIKit; - @implementation ISHPermissionRequestNotificationsRemote - -- (ISHPermissionState)permissionState { - if (![[UIApplication sharedApplication] respondsToSelector:@selector(isRegisteredForRemoteNotifications)]) { - return ISHPermissionStateUnsupported; - } - - return [super permissionState]; -} - @end #endif diff --git a/ISHPermissionKit/Requests/ISHPermissionRequestUserNotification.h b/ISHPermissionKit/Requests/ISHPermissionRequestUserNotification.h index 6da6be9..a468608 100644 --- a/ISHPermissionKit/Requests/ISHPermissionRequestUserNotification.h +++ b/ISHPermissionKit/Requests/ISHPermissionRequestUserNotification.h @@ -38,7 +38,7 @@ * * @sa -permissionsViewController:didConfigureRequest: */ -@property (nonatomic) UNAuthorizationOptions desiredOptions; +@property (nonatomic) UNAuthorizationOptions desiredOptions __IOS_AVAILABLE(10.0); @end diff --git a/ISHPermissionKit/Requests/ISHPermissionRequestUserNotification.m b/ISHPermissionKit/Requests/ISHPermissionRequestUserNotification.m index 963ae35..bddeb54 100644 --- a/ISHPermissionKit/Requests/ISHPermissionRequestUserNotification.m +++ b/ISHPermissionKit/Requests/ISHPermissionRequestUserNotification.m @@ -40,11 +40,6 @@ - (BOOL)allowsConfiguration { } - (ISHPermissionState)permissionState { - if (![UIUserNotificationSettings class]) { - // no need to request permission before iOS 8 - return ISHPermissionStateAuthorized; - } - if (![UNUserNotificationCenter class]) { // cannot request using the new API: should use // ISHPermissionCategoryNotificationRemote/...Local @@ -64,6 +59,7 @@ - (ISHPermissionState)permissionStateForNotificationSettings:(UNNotificationSett case UNAuthorizationStatusDenied: return ISHPermissionStateDenied; + case UNAuthorizationStatusProvisional: case UNAuthorizationStatusNotDetermined: return ISHPermissionStateUnknown; } From 3cff47b1edb74c9aaa23c80fde50cca7b22f27f9 Mon Sep 17 00:00:00 2001 From: Sebastian Hagedorn Date: Tue, 4 Sep 2018 19:08:36 +0200 Subject: [PATCH 5/8] Use Xcode 10 on Travis CI --- .travis.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 8fc4c21..ded8611 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,15 +1,15 @@ language: objective-c -osx_image: xcode8 +osx_image: xcode10 install: - gem install xcpretty --no-rdoc --no-ri --no-document --quiet script: - set -o pipefail # Build framework target and clean all targets between builds - - xcodebuild -project ISHPermissionKit.xcodeproj -scheme ISHPermissionKit -destination 'platform=iOS Simulator,name=iPhone 6' -derivedDataPath build/ISHPermissionKit clean build | xcpretty + - xcodebuild -project ISHPermissionKit.xcodeproj -scheme ISHPermissionKit -destination 'platform=iOS Simulator,name=iPhone 8' -derivedDataPath build/ISHPermissionKit clean build | xcpretty # Build static lib target and clean all targets between builds - - xcodebuild -project ISHPermissionKit.xcodeproj -scheme ISHPermissionKitLib -destination 'platform=iOS Simulator,name=iPhone 6' -derivedDataPath build/ISHPermissionKitLib clean build | xcpretty + - xcodebuild -project ISHPermissionKit.xcodeproj -scheme ISHPermissionKitLib -destination 'platform=iOS Simulator,name=iPhone 8' -derivedDataPath build/ISHPermissionKitLib clean build | xcpretty # run tests - - xcodebuild -project ISHPermissionKit.xcodeproj -scheme 'ISHPermissionKit' -destination 'platform=iOS Simulator,name=iPhone 6' -derivedDataPath build/ISHPermissionKit clean test | xcpretty + - xcodebuild -project ISHPermissionKit.xcodeproj -scheme 'ISHPermissionKit' -destination 'platform=iOS Simulator,name=iPhone 8' -derivedDataPath build/ISHPermissionKit clean test | xcpretty From 6b56a6983db4c99adba6b481957907ab136500fa Mon Sep 17 00:00:00 2001 From: Sebastian Hagedorn Date: Wed, 5 Sep 2018 10:15:10 +0200 Subject: [PATCH 6/8] Add comment re: provisional notification auth state --- .../Requests/ISHPermissionRequestUserNotification.m | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/ISHPermissionKit/Requests/ISHPermissionRequestUserNotification.m b/ISHPermissionKit/Requests/ISHPermissionRequestUserNotification.m index bddeb54..e9e72c1 100644 --- a/ISHPermissionKit/Requests/ISHPermissionRequestUserNotification.m +++ b/ISHPermissionKit/Requests/ISHPermissionRequestUserNotification.m @@ -59,6 +59,15 @@ - (ISHPermissionState)permissionStateForNotificationSettings:(UNNotificationSett case UNAuthorizationStatusDenied: return ISHPermissionStateDenied; + /** + * You can ask for provisional permission (you must do this explicitly via desiredOptions, + * which will allow you to send one quiet (no alert/sound, but in the notification center) + * notification. Users can change their settings directly from notification center. + * + * After requesting provisional permission, the auth state stays in UNAuthorizationStatusProvisional + * until the user has made a decision. During that time, you may also request general permission, + * which is why we treat it as UNAuthorizationStatusNotDetermined here. + */ case UNAuthorizationStatusProvisional: case UNAuthorizationStatusNotDetermined: return ISHPermissionStateUnknown; From 7d4acdc32e2e153616158facdf1881a724e41d49 Mon Sep 17 00:00:00 2001 From: Sebastian Hagedorn Date: Wed, 5 Sep 2018 10:37:51 +0200 Subject: [PATCH 7/8] Update changelog and bump versions --- CHANGELOG.md | 15 ++++++++++---- ISHPermissionKit.xcodeproj/project.pbxproj | 24 +++++++++++----------- 2 files changed, 23 insertions(+), 16 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ffc68e8..23092ef 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## 2.1 + +* Ready for Xcode 10 and iOS 12 +* Bump deployment target to iOS 9 +* Remove deprecated permission categories (AssetsLibrary and AddressBook-based APIs) +* Allow determination of possible requests without displaying any UI + ## 2.0 This release requires additional setup to ensure your apps pass binary validation in iTunes Connect. Please study the [README](/README.md) file carefully. @@ -13,9 +20,9 @@ This release requires additional setup to ensure your apps pass binary validatio ## 1.2.0 * Provide callback to handle true errors -* Fix issues for social media account permissions if user had no user account: - **this may require your implementations to handle the error to avoid asking the user - again for permission** +* Fix issues for social media account permissions if user had no user account: + **this may require your implementations to handle the error to avoid asking the user + again for permission** * Add methods to query request-able and granted permissions given a set of categories * Add some rudimentary unit tests @@ -57,7 +64,7 @@ This release requires additional setup to ensure your apps pass binary validatio ## 0.6.0 * HealthKit is not used in default setting. If you need to use HealthKit please consult the readme and use the ISHPermissionKitLib+HealthKit variant. -* This is an important update if you do not use HealthKit as you might otherwise get a rejection from Apple for not providing a privacy policy or have no reason to link to HealthKit. +* This is an important update if you do not use HealthKit as you might otherwise get a rejection from Apple for not providing a privacy policy or have no reason to link to HealthKit. ## 0.5.0 diff --git a/ISHPermissionKit.xcodeproj/project.pbxproj b/ISHPermissionKit.xcodeproj/project.pbxproj index 08773c8..2a276d1 100644 --- a/ISHPermissionKit.xcodeproj/project.pbxproj +++ b/ISHPermissionKit.xcodeproj/project.pbxproj @@ -625,7 +625,7 @@ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 3; + CURRENT_PROJECT_VERSION = 4; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = YES; GCC_C_LANGUAGE_STANDARD = gnu99; @@ -644,10 +644,10 @@ GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 9.0; - ISH_BUNDLE_VERSION = 0; ISH_BUNDLE_VERSION_MAJOR = 2; - ISH_BUNDLE_VERSION_MINOR = 0; - ISH_BUNDLE_VERSION_SHORT = "${ISH_BUNDLE_VERSION_MAJOR}.${ISH_BUNDLE_VERSION_MINOR}.${ISH_BUNDLE_VERSION}"; + ISH_BUNDLE_VERSION_MINOR = 1; + ISH_BUNDLE_VERSION_PATCH = 0; + ISH_BUNDLE_VERSION_SHORT = "${ISH_BUNDLE_VERSION_MAJOR}.${ISH_BUNDLE_VERSION_MINOR}.${ISH_BUNDLE_VERSION_PATCH}"; METAL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; @@ -765,7 +765,7 @@ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 3; + CURRENT_PROJECT_VERSION = 4; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = YES; GCC_C_LANGUAGE_STANDARD = gnu99; @@ -784,10 +784,10 @@ GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 9.0; - ISH_BUNDLE_VERSION = 0; ISH_BUNDLE_VERSION_MAJOR = 2; - ISH_BUNDLE_VERSION_MINOR = 0; - ISH_BUNDLE_VERSION_SHORT = "${ISH_BUNDLE_VERSION_MAJOR}.${ISH_BUNDLE_VERSION_MINOR}.${ISH_BUNDLE_VERSION}"; + ISH_BUNDLE_VERSION_MINOR = 1; + ISH_BUNDLE_VERSION_PATCH = 0; + ISH_BUNDLE_VERSION_SHORT = "${ISH_BUNDLE_VERSION_MAJOR}.${ISH_BUNDLE_VERSION_MINOR}.${ISH_BUNDLE_VERSION_PATCH}"; METAL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; @@ -829,7 +829,7 @@ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; COPY_PHASE_STRIP = YES; - CURRENT_PROJECT_VERSION = 3; + CURRENT_PROJECT_VERSION = 4; ENABLE_NS_ASSERTIONS = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; GCC_C_LANGUAGE_STANDARD = gnu99; @@ -841,10 +841,10 @@ GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 9.0; - ISH_BUNDLE_VERSION = 0; ISH_BUNDLE_VERSION_MAJOR = 2; - ISH_BUNDLE_VERSION_MINOR = 0; - ISH_BUNDLE_VERSION_SHORT = "${ISH_BUNDLE_VERSION_MAJOR}.${ISH_BUNDLE_VERSION_MINOR}.${ISH_BUNDLE_VERSION}"; + ISH_BUNDLE_VERSION_MINOR = 1; + ISH_BUNDLE_VERSION_PATCH = 0; + ISH_BUNDLE_VERSION_SHORT = "${ISH_BUNDLE_VERSION_MAJOR}.${ISH_BUNDLE_VERSION_MINOR}.${ISH_BUNDLE_VERSION_PATCH}"; METAL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; TARGETED_DEVICE_FAMILY = "1,2"; From 25e211ade2fae57c290d1daa0f358dbd08be8f9d Mon Sep 17 00:00:00 2001 From: Sebastian Hagedorn Date: Wed, 5 Sep 2018 10:47:15 +0200 Subject: [PATCH 8/8] Clean up README * remove iOS 7 references and fix deployment/SDK requirements --- README.md | 69 +++++++++++++++++++++++++------------------------------ 1 file changed, 31 insertions(+), 38 deletions(-) diff --git a/README.md b/README.md index 5dd547f..1f4b317 100644 --- a/README.md +++ b/README.md @@ -34,14 +34,14 @@ where the system APIs only provide implicit methods of doing so. * Siri * Speech Recognition -The library compiles with the **iOS 9.3 SDK** and later and deploys back to -**iOS 7**. Permission categories that were added later than the deployment +The library compiles with the **iOS 11 SDK** and later and deploys back to +**iOS 9**. Permission categories that were added later than the deployment target will be skipped on unsupported versions. All permission categories relate to **sensitive user information**. If your app binary contains code to access this information, it has to comply with special review guidelines and other requirements to pass binary validation -in iTunes Connect and app review. Therefore, you must specifically enable +in App Store Connect and app review. Therefore, you must specifically enable the categories you need with build flags, everything else will not be included in the framework. Please read the [installation instructions](#installation) carefully. @@ -51,9 +51,9 @@ app's `Info.plist`. If the `DEBUG` preprocessor macro is set, it will assert and explain which keys need to be added. Other requirements for each permission category are mentioned in the header documentation in `ISHPermissionCategory.h`. -Sample App Demo +Sample App Demo -In contrast to other libraries, *ISHPermissionKit* allows you to present custom +In contrast to other libraries, *ISHPermissionKit* allows you to present custom view controllers, ask for several permissions in a sequence, provides a unified API through subclasses, and is **iOS 10 compatible**. @@ -84,24 +84,23 @@ The sample app uses the [dynamically-linked framework](#dynamically-linked-frame Your variant of *ISHPermissionKit* will only include the permission categories you actually need. We use preprocessor macros to ensure any unused code is not -compiled to save you from suprising App Store rejections, as some privacy -guidelines apply to all apps that *contain* code to access user data, regardless +compiled to save you from suprising App Store rejections, as some privacy +guidelines apply to all apps that *contain* code to access user data, regardless of whether or not the code is ever called in your app. How to enable the categories you need depends on how you install *ISHPermissionKit* (see below). ### Static Library -Add this Xcode project as a subproject of your app. Then link your app target +Add this Xcode project as a subproject of your app. Then link your app target against the static library (`ISHPermissionKitLib.a`). You will also need to add -the static library as a target dependency. Both settings can be found in your +the static library as a target dependency. Both settings can be found in your app target's *Build Phases*. **You must [provide a build configuration](#providing-a-build-configuration) manually.** Use `#import ` to import all public headers. -The static library version is recommended when you need to support iOS 7 or -if you are concerned about app launch time, as a high number of dynamic libraries -could increase the latter. +The static library version is recommended if you are concerned about app launch +times, as a high number of dynamic libraries [could increase the latter](https://developer.apple.com/videos/play/wwdc2016/406/). ### Dynamically-Linked Framework @@ -117,12 +116,9 @@ You can use [Carthage](https://github.com/Carthage/Carthage) to fetch and build the framework. You will still have to provide a build configuration manually. The framework can be used as a module, so you can use `@import ISHPermissionKit;` -to import all public headers. +to import all public headers. Further reading on Modules: [Clang Documentation](http://clang.llvm.org/docs/Modules.html) -**Note:** To link against dynamic frameworks on iOS, a deployment target of at -least iOS 8 is required. If you use Swift, you must use dynamic frameworks. - ### Providing a Build Configuration When building the static or dynamic library, *ISHPermissionKit* will look for a @@ -150,7 +146,7 @@ in it. Ensure to always use `$(inherit)` when setting preprocessor macros. *ISHPermissionKit* uses system frameworks to accomplish its tasks. Most of them will be linked automatically unless you have disabled "Enable Modules" -(`CLANG_ENABLE_MODULES`) and "Link Frameworks Automatically" +(`CLANG_ENABLE_MODULES`) and "Link Frameworks Automatically" (`CLANG_MODULES_AUTOLINK`) in your app target's build settings. Unfortunately, some framework are not weakly linked automatically which @@ -204,10 +200,10 @@ You can request permission for a single category or a sequence of categories. The following example presents a `ISHPermissionsViewController` for `Activity` and `LocationWhenInUse` permissions if needed. -```objective-c -NSArray *permissions = @[ - @(ISHPermissionCategoryLocationWhenInUse), - @(ISHPermissionCategoryActivity) +```objective-c +NSArray *permissions = @[ + @(ISHPermissionCategoryLocationWhenInUse), + @(ISHPermissionCategoryActivity) ]; ISHPermissionsViewController *vc = [ISHPermissionsViewController permissionsViewControllerWithCategories:permissions dataSource:self]; @@ -216,8 +212,8 @@ if (vc) { [presentingVC presentViewController:vc animated:YES completion:nil]; -} -``` +} +``` The designated constructor returns `nil` if non of the categories allow a user prompt (either because the user already granted or denied the permission, does @@ -232,7 +228,7 @@ do set a delegate, the delegate is responsible for dismissing the view controller. The `dataSource` is required and must provide one instance of a -`ISHPermissionRequestViewController` for each requested +`ISHPermissionRequestViewController` for each requested `ISHPermissionCategory`. The `ISHPermissionRequestViewController` provides `IBAction`s to _prompt for the @@ -241,7 +237,7 @@ any buttons or UI. Your subclass can create a view with text, images, and button etc., explaining in greater detail why your app needs a certain permission. The subclass should contain buttons that trigger at least one of the actions mentioned above (see the header for their signatures). A _cancel button_ should -call `changePermissionStateToAskAgainFromSender:`. If your subclass overwrites +call `changePermissionStateToAskAgainFromSender:`. If your subclass overwrites any of these three actions, you must call `super`. ## ISHPermissionRequest @@ -255,22 +251,22 @@ appropriate request for the given permission category. Here is how you check the permissions to access the microphone: -```objective-c +```objective-c ISHPermissionRequest *r = [ISHPermissionRequest requestForCategory:ISHPermissionCategoryMicrophone]; BOOL granted = ([r permissionState] == ISHPermissionStateAuthorized); ``` -The same example for local notifications (`granted` will always be true on iOS 7): +The same example for local notifications: -```objective-c +```objective-c ISHPermissionRequest *r = [ISHPermissionRequest requestForCategory:ISHPermissionCategoryNotificationLocal]; BOOL granted = ([r permissionState] == ISHPermissionStateAuthorized); ``` # How to Contribute -Contributions are welcome. Check out the roadmap and open issues. -Adding support for more permission types is probably +Contributions are welcome. Check out the roadmap and open issues. +Adding support for more permission types is probably most rewarding, you can find a few hints on how to get started below. ## Adding Support for New Permissions @@ -308,8 +304,8 @@ and create a new CocoaPods subspec. # Attribution -*ISHPermissionKit* icon designed by -[Jason Grube (CC BY 3.0)](http://thenounproject.com/term/fingerprint/23303/) from the +*ISHPermissionKit* icon designed by +[Jason Grube (CC BY 3.0)](http://thenounproject.com/term/fingerprint/23303/) from the [Noun Project](http://thenounproject.com) # More OpenSource Projects by iosphere @@ -320,16 +316,13 @@ and create a new CocoaPods subspec. # Apps Using ISHPermissionKit - + Trails · Outdoor GPS Logbook - -Rudel · Anonymous Location Sharing - - + SumUp – Accept EMV card payments - + Swiss Snow Report If your app uses ISHPermissionKit, let us know and we will include it here.