浏览代码

Remove iOS9 conditionals - PHPhotoLibrary is available in iOS8

Reference: https://developer.apple.com/library/ios/documentation/Photos/Reference/PHPhotoLibrary_Class/index.html
Darin Wilson 9 年之前
父节点
当前提交
396ead6c3f
共有 1 个文件被更改,包括 1 次插入27 次删除
  1. 1 27
      permissions/RNPPhoto.m

+ 1 - 27
permissions/RNPPhoto.m

@@ -10,15 +10,12 @@
 #import <AddressBook/AddressBook.h>
 #import <AssetsLibrary/AssetsLibrary.h>
 
-#if __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_9_0
 @import Photos;
-#endif
 
 @implementation RNPPhoto
 
 + (NSString *)getStatus
 {
-#if __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_9_0
     int status = [PHPhotoLibrary authorizationStatus];
     switch (status) {
         case PHAuthorizationStatusAuthorized:
@@ -30,19 +27,6 @@
         default:
             return RNPStatusUndetermined;
     }
-#else
-    int status = ABAddressBookGetAuthorizationStatus();
-    switch (status) {
-        case kABAuthorizationStatusAuthorized:
-            return RNPStatusAuthorized;
-        case kABAuthorizationStatusDenied:
-            return RNPStatusDenied;
-        case kABAuthorizationStatusRestricted:
-            return RNPStatusRestricted;
-        default:
-            return RNPStatusUndetermined;
-    }
-#endif
 }
 
 + (void)request:(void (^)(NSString *))completionHandler
@@ -52,19 +36,9 @@
             completionHandler([self.class getStatus]);
         });
     };
-    
-#if __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_9_0
+
     [PHPhotoLibrary requestAuthorization:^(PHAuthorizationStatus status) {
         handler();
     }];
-#else
-    ALAssetsLibrary *library = [[ALAssetsLibrary alloc] init];
-    [library enumerateGroupsWithTypes:ALAssetsGroupSavedPhotos usingBlock:^(ALAssetsGroup *group, BOOL *stop) {
-        handler();
-        *stop = YES;
-    } failureBlock:^(NSError *error) {
-        handler();
-    }];
-#endif
 }
 @end