Error Domain=NSCocoaErrorDomain Code=257 "The file “IMG_0125.PNG” couldn’t be opened because you don’t have permission to view it." UserInfo={NSFilePath=/var/mobile/Media/DCIM/100APPLE/IMG_0125.PNG, NSUnderlyingError=0x1c045d130 Error Domain=NSPOSIXErrorDomain Code=1 "Operation not permitted"}}
I am getting above error while using below code
do{
try filemanager.copyItem(at: sourceURL, to: dirConPath1)
}catch let error as NSError{
print(error.debugDescription)
}
Also I have added:
<key>NSPhotoLibraryUsageDescription</key>
<string>want access of photos</string>
<key>NSPhotoLibraryAddUsageDescription</key>
<string>photos save description.</string>
into the info.plist
I am using Swift 4.1 and Xcode 9.3.1.