iOS版是不是要求用户对图片库的权限了。 甚至当我从设备中删除该应用。 这也发生在模拟器。
switch ([ALAssetsLibrary authorizationStatus])
{
case ALAuthorizationStatusAuthorized:
RPMLog(@"authorized");
break;
case ALAuthorizationStatusDenied:
RPMLog(@"denied");
break;
case ALAuthorizationStatusNotDetermined:
RPMLog(@"not determined");
break;
case ALAuthorizationStatusRestricted:
RPMLog(@"restricted");
break;
}
当我安装的应用程序,第一次我已经授权。 在此之前,有询问的照片触发用户提示没有其他事件或屏幕。
然后我要求numberOfAssets在SavedPhotos并得到它没有访问的提示:
ALAssetsLibrary *library = [[ALAssetsLibrary alloc] init];
[library enumerateGroupsWithTypes:ALAssetsGroupSavedPhotos usingBlock:^(ALAssetsGroup *group, BOOL *stop) {
if (!group) return;
UIActionSheet *actionSheet = nil;
if (([group numberOfAssets] > 0))
{
actionSheet = [[UIActionSheet alloc] initWithTitle:nil delegate:self cancelButtonTitle:NSLocalizedString(@"Cancel", nil) destructiveButtonTitle:nil otherButtonTitles:NSLocalizedString(@"Take new photo", nil), NSLocalizedString(@"Use last photo taken", nil), NSLocalizedString(@"Choose existing", nil), nil];
}
else
{
actionSheet = [[UIActionSheet alloc] initWithTitle:nil delegate:self cancelButtonTitle:NSLocalizedString(@"Cancel", nil) destructiveButtonTitle:nil otherButtonTitles:NSLocalizedString(@"Take new photo", nil), NSLocalizedString(@"Choose existing", nil), nil];
}
actionSheet.actionSheetStyle = UIActionSheetStyleBlackTranslucent;
[actionSheet showFromTabBar:self.tabBar];
[TestFlight passCheckpoint:@"New Look: Tab Bar"];
} failureBlock:^(NSError *error) {
NSAssert(!error, [error description]);
}];