Browse Source

Merge pull request #17 from darinwilson/more-ios-8-fixes

More iOS 8 fixes
Yonah Forst 8 years ago
parent
commit
e6f25fa5f5
2 changed files with 3 additions and 29 deletions
  1. 2
    2
      ReactNativePermissions.xcodeproj/project.pbxproj
  2. 1
    27
      permissions/RNPPhoto.m

+ 2
- 2
ReactNativePermissions.xcodeproj/project.pbxproj View File

225
 				GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
225
 				GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
226
 				GCC_WARN_UNUSED_FUNCTION = YES;
226
 				GCC_WARN_UNUSED_FUNCTION = YES;
227
 				GCC_WARN_UNUSED_VARIABLE = YES;
227
 				GCC_WARN_UNUSED_VARIABLE = YES;
228
-				IPHONEOS_DEPLOYMENT_TARGET = 9.1;
228
+				IPHONEOS_DEPLOYMENT_TARGET = 8.0;
229
 				MTL_ENABLE_DEBUG_INFO = YES;
229
 				MTL_ENABLE_DEBUG_INFO = YES;
230
 				ONLY_ACTIVE_ARCH = YES;
230
 				ONLY_ACTIVE_ARCH = YES;
231
 				SDKROOT = iphoneos;
231
 				SDKROOT = iphoneos;
262
 				GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
262
 				GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
263
 				GCC_WARN_UNUSED_FUNCTION = YES;
263
 				GCC_WARN_UNUSED_FUNCTION = YES;
264
 				GCC_WARN_UNUSED_VARIABLE = YES;
264
 				GCC_WARN_UNUSED_VARIABLE = YES;
265
-				IPHONEOS_DEPLOYMENT_TARGET = 9.1;
265
+				IPHONEOS_DEPLOYMENT_TARGET = 8.0;
266
 				MTL_ENABLE_DEBUG_INFO = NO;
266
 				MTL_ENABLE_DEBUG_INFO = NO;
267
 				SDKROOT = iphoneos;
267
 				SDKROOT = iphoneos;
268
 				VALIDATE_PRODUCT = YES;
268
 				VALIDATE_PRODUCT = YES;

+ 1
- 27
permissions/RNPPhoto.m View File

10
 #import <AddressBook/AddressBook.h>
10
 #import <AddressBook/AddressBook.h>
11
 #import <AssetsLibrary/AssetsLibrary.h>
11
 #import <AssetsLibrary/AssetsLibrary.h>
12
 
12
 
13
-#if __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_9_0
14
 @import Photos;
13
 @import Photos;
15
-#endif
16
 
14
 
17
 @implementation RNPPhoto
15
 @implementation RNPPhoto
18
 
16
 
19
 + (NSString *)getStatus
17
 + (NSString *)getStatus
20
 {
18
 {
21
-#if __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_9_0
22
     int status = [PHPhotoLibrary authorizationStatus];
19
     int status = [PHPhotoLibrary authorizationStatus];
23
     switch (status) {
20
     switch (status) {
24
         case PHAuthorizationStatusAuthorized:
21
         case PHAuthorizationStatusAuthorized:
30
         default:
27
         default:
31
             return RNPStatusUndetermined;
28
             return RNPStatusUndetermined;
32
     }
29
     }
33
-#else
34
-    int status = ABAddressBookGetAuthorizationStatus();
35
-    switch (status) {
36
-        case kABAuthorizationStatusAuthorized:
37
-            return RNPStatusAuthorized;
38
-        case kABAuthorizationStatusDenied:
39
-            return RNPStatusDenied;
40
-        case kABAuthorizationStatusRestricted:
41
-            return RNPStatusRestricted;
42
-        default:
43
-            return RNPStatusUndetermined;
44
-    }
45
-#endif
46
 }
30
 }
47
 
31
 
48
 + (void)request:(void (^)(NSString *))completionHandler
32
 + (void)request:(void (^)(NSString *))completionHandler
52
             completionHandler([self.class getStatus]);
36
             completionHandler([self.class getStatus]);
53
         });
37
         });
54
     };
38
     };
55
-    
56
-#if __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_9_0
39
+
57
     [PHPhotoLibrary requestAuthorization:^(PHAuthorizationStatus status) {
40
     [PHPhotoLibrary requestAuthorization:^(PHAuthorizationStatus status) {
58
         handler();
41
         handler();
59
     }];
42
     }];
60
-#else
61
-    ALAssetsLibrary *library = [[ALAssetsLibrary alloc] init];
62
-    [library enumerateGroupsWithTypes:ALAssetsGroupSavedPhotos usingBlock:^(ALAssetsGroup *group, BOOL *stop) {
63
-        handler();
64
-        *stop = YES;
65
-    } failureBlock:^(NSError *error) {
66
-        handler();
67
-    }];
68
-#endif
69
 }
43
 }
70
 @end
44
 @end