I am working on an Iphone app and I can enumerate assets using the Assetslibrary and load them into a table view. The user can delete a row (a picture / video) in the app but how do I UPDATE the Iphone photo album directly from my app? Otherwise on refreshing, the tableview will reload the previously deleted asset.
相关问题
- Core Data lightweight migration crashes after App
- How can I implement password recovery in an iPhone
- State preservation and restoration strategies with
- “Zero out” sensitive String data in Swift
- Get the NSRange for the visible text after scroll
相关文章
- 现在使用swift开发ios应用好还是swift?
- UITableView dragging distance with UIRefreshContro
- TCC __TCCAccessRequest_block_invoke
- Where does a host app handle NSExtensionContext#co
- Swift - hide pickerView after value selected
- How do you detect key up / key down events from a
- didBeginContact:(SKPhysicsContact *)contact not in
- Laravel: What's the advantage of using the ass
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.
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/documentation/photos/phassetchangerequest/1624062-deleteassets PHPhotoLibrary Class - authorizationStatus https://developer.apple.com/documentation/photos/phphotolibrary/1620745-authorizationstatus
It late but for other users it will help.
As we know only the photos app can delete images. In such situation, i retrieved all images from photos via alassets, viewed them in custom gallery, given user a option to select multiple images from assets to save them in phone directory. Next i am using my app gallery instead of photos gallery. I have given the option in the app to import images from photos to app gallery (which is a document directory folder of images) at any time in the app.
Adding an answer to an old question here, because we are often asked for Screenshot prevention as part of a Data-Loss-Prevention (DLP) solution. You can (a) register for screenshot notifications and (b) ask the user to delete when it occurs, but there's no way to do it silently or secretly. Here's a full working code example:
The result is this:
Possible duplication of https://stackoverflow.com/a/11058934/300292. Simple answer: you can't. The Photos app is the only place you can delete assets. Which is probably a good thing--you wouldn't want any willy-nilly app to be able to delete all your photos, would you?
in ios8 deleting photos is possible using the Photos Framework
Please check the documentation of Photos Framework
For deleting assets refer to PHAssetChangeRequest
where
assets
is an array ofPHAsset
objects to be deleted.+
For deleting collections refer to PHAssetCollectionChangeRequest
https://developer.apple.com/documentation/photos/phassetchangerequest/1624062-deleteassets
https://developer.apple.com/documentation/photos/phassetcollectionchangerequest/1619453-deleteassetcollections