Code=1 "Operation not permitted"

Specific given as follows:

Error: Error Domain = NSCocoaErrorDomain Code = 257 "Could not open file" IMG_0040.mp4 ", because you do not have permission to view it." UserInfo = {NSFilePath = / var / mobile / Media / DCIM / 100APPLE / IMG_0040.mp4, NSUnderlyingError = 0x2802bf990 {Error Domain = NSPOSIXErrorDomain Code = 1 "Operation not permitted"}} Optional ([ "NSFilePath": /var/mobile/Media/DCIM/100APPLE/IMG_0040.mp4, "NSUnderlyingError": Error Domain = NSPOSIXErrorDomain Code = 1 "Operation not permitted"]) failed to open file "IMG_0040.mp4", because you do not have permission to view it.

Under normal circumstances IOS is not directly accessible by a path to address the contents of the album inside of (niche did not notice before), until the discovery as one kind of case:

  After normally get to an album by PhAsset Assert can then be obtained by converting into AVURLAsset URL, then get the address, this time via this address can be normal access to the file, just I demand an upload server, simulated a sudden interruption, continue to upload the scene, when I killed by APP, and then re-upload this resource is open, it is reported out of the above error, the strange thing is video playback through this address to instantiate the resource URL, the video can be played normally, is their own with FileManage to get this file information on the error. A variety of debugging path than to confirm no problem over the wall after google, did not find the same reason, it was accidentally remember not to ask a path through the album, but before obviously used properly. At this time I realized that as long as I will not get to call the album interface, can be accessed through the path. Immediately test it, and sure enough, I'll just open the screen before the image is selected, do not select any resources, turn off the upload page to come back, this time you can normally access the file and upload it through the path.

Make a note of the other apes have the same haunted able to solve their own problems, or the way I use the wrong, get after the album resources should be saved to the sandbox.

Guess you like

Origin www.cnblogs.com/Purk/p/11760737.html