1

Getting this error when uploading file to server

Error Domain=NSCocoaErrorDomain Code=257 "The file “IMG_0011.MOV”   couldn’t be opened because you don’t have permission to view it." UserInfo={NSFilePath=/var/mobile/Media/DCIM/100APPLE/IMG_0011.MOV, NSUnderlyingError=0x13b157510 {Error Domain=NSPOSIXErrorDomain Code=1  "Operation not permitted"}}

My code for converting path to NSDATA is:

 let videoURL = User.sharedInstance.arrRoomGalleryVideos.objectAtIndex(index) as? NSURL
            var movieData: NSData?
            do {
                let video = try NSData(contentsOfURL: videoURL!, options: .DataReadingMappedIfSafe)
               // print("video", video)
                multipartFormData.appendBodyPart(data: video, name: "video_path[]", fileName: strVidName, mimeType: "mp4/.mov")
            } catch {
                print(error)
                return
            }
iPhone 7
  • 1,483
  • 20
  • 54

1 Answers1

0

You can try this -

Navigate to Build Settings -> Go to Build Options and change the value of the "Compiler for C/C++/Objective-C" to Default Compiler.

For more solutions check this

Community
  • 1
  • 1
Techidiot
  • 1,851
  • 1
  • 11
  • 27