5

私のアプリが作成しなかった写真アプリのカメラ ロールの画像 (およびビデオ) を削除する方法はありますか。アプリで作成されていないものをアセット ライブラリから削除できないことは承知しています。しかし、このアプリはアプリストアにありません。キオスクタイプの環境にあります。したがって、プライベート API を使用できます。

Appleがアプリストアに対して承認しないプライベートAPIを使用してこれを行う方法はありますが、私の状況では機能します。

ありがとう。

4

2 に答える 2

11

Yep, you can do this in iOS 8 using Photos framework.

For example if you have Assets URLs stored in NSArray *assetsURLs

PHPhotoLibrary *library = [PHPhotoLibrary sharedPhotoLibrary];
    [library performChanges:^{
        PHFetchResult *assetsToBeDeleted = [PHAsset fetchAssetsWithALAssetURLs:assetsURLs options:nil];
        [PHAssetChangeRequest deleteAssets:assetsToBeDeleted];
    } completionHandler:^(BOOL success, NSError *error)
     {
         //do something here
    }];

this code will ask user to confirm removal from Camera Roll.

于 2015-01-13T18:42:38.337 に答える