Problems with csv-Import

I want to import a csv-file to my app. It works when I use the Simulator but when I try to import the same file on my iPad, the follwowing message occurs: UserInfo={NSFilePath=/private/var/mobile/Containers/Shared/AppGroup/4C49BACA-5490-45A4-A8DF-6D47711CFC34/File Provider Storage/LUSD 3.csv, NSUnderlyingError=0x2812068e0 {Error Domain=NSPOSIXErrorDomain Code=1 "Operation not permitted"}}. Where do I find the right settings to enable the import of this csv-file?

Is that where you are saving the file? It sounds like it is in the bundle and on a real device that will be write protected.

You need to save the file in a write enabled folder. Documents or some where in the Application Data folder, for instance.

First up, I recommend that you read On File System Permissions. While it’s focused on the Mac, some key concepts apply to iOS as well.

How did you get this URL? If, for example, you get it from one of the standard file UIs, like UIDocumentPickerViewController, the result is a security-scoped URL. To access the file’s contents, you need to call the startAccessingSecurityScopedResource() method. Don’t forget to call the stop method when you’re done.

The blog post referenced by jlilest has a concrete example of this.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Problems with csv-Import
 
 
Q