1

I have an application that deletes photos from the camera roll. This wipe is initiated remotely. Due to this if a wipe is initiated and the user is not at their phone they it will not wipe because you need to authorize the delete for each image.

Now I've read this is not possible in different questions. However, is it possible to request authorization to the phones photo library just as is done with geolocation when the application finishes loading on the first launch. Would this grant authorization for deleting without the need to confirm for every photo?

This is how I'm currently deleting the photos, it works fine apart from the need to confirm deletion of every image

         PHFetchResult *asset = [PHAsset fetchAssetsWithMediaType:PHAssetMediaTypeImage options:nil];

    [asset enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {
        NSLog(@"%@",[obj class]);
        [[PHPhotoLibrary sharedPhotoLibrary] performChanges:^{
            BOOL req = [obj canPerformEditOperation:PHAssetEditOperationDelete];
            if (req) {
                NSLog(@"true");
                [PHAssetChangeRequest deleteAssets:@[obj]];
            }
        } completionHandler:^(BOOL success, NSError *error) {
            NSLog(@"Finished Delete asset. %@", (success ? @"Success." : error));
            if (success) {
                NSLog(@"WIPE SUCCESSFUL");
            }
        }];
    }];
3rdeye7
  • 536
  • 4
  • 25

2 Answers2

0

It's not possible to delete any photos/videos through the provided APIs without the confirmation alert. There is no way around this.

holtmann
  • 6,043
  • 32
  • 44
0

The app requests authorization for photo to get access permissions to the photos. This permission is to get photos (application can copy all the photos in the device, do you want any app could do so?), not to delete them.

If you want to delete some asset or collections you have to receive specific authorization from the user each time. You can do some changes together with request authorization only once - but you have to contact with the user at least once about this.