ALAssetsLibrary delete ALAssetsGroup / ALAsset

前端 未结 6 1532
终归单人心
终归单人心 2020-12-09 23:20

I have created \"photos album\" from my App, using IOS AssetsLibrary.

Reading ALAssetsLibrary,ALAssetsGroup and ALAsset documentations, i have seen methods to \"addA

6条回答
  •  半阙折子戏
    2020-12-09 23:41

    As Ted said, this is now possible in iOS 8 using the Photos service. It's pretty clean actually. You need to submit a change request to the photolibrary. Here's an example.

    [[PHPhotoLibrary sharedPhotoLibrary] performChanges:^{
        [PHAssetChangeRequest deleteAssets:arrayOfPHAssets];
    } completionHandler:^(BOOL success, NSError *error) {
        NSLog(@"Finished deleting asset. %@", (success ? @"Success." : error));
    }];
    

    Make sure you've imported Photos, and gotten authorization from the user. (Which you probably did to show the image already)

    PHAssetchangeRequest - deleteAssets https://developer.apple.com/library/prerelease/ios/documentation/Photos/Reference/PHAssetChangeRequest_Class/index.html#//apple_ref/occ/clm/PHAssetChangeRequest/deleteAssets: PHPhotoLibrary Class - authorizationStatus https://developer.apple.com/library/ios/documentation/Photos/Reference/PHPhotoLibrary_Class/#//apple_ref/occ/clm/PHPhotoLibrary/authorizationStatus

提交回复
热议问题