Note that there are some explanatory texts on larger screens.

plurals
  1. POObject serialization not working when testing on real iPhone (works in simulator)
    primarykey
    data
    text
    <p>I have an app where I save data to a file before quitting (or going to background) and that restores it reading from the file when restarting the app. The problem is that this works perfectly on the simulator, but doesn't on a real device. Here is the code I use to get the path (on applicationDidFinishLaunching):</p> <pre><code>NSString *path=[[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0]stringByAppendingString:@"archive"]; NSLog(@"Reading from filePath:%@",path); if ([[NSFileManager defaultManager]fileExistsAtPath:path]) { //Init data from file } else { //Present the view where the users has to enter info for the first time (this is what always gets executed) } </code></pre> <p>And this is the code that I use to save the data(on applicationDidEnterBackground):</p> <pre><code>NSString *path=[[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0]stringByAppendingString:@"archive"]; NSLog(@"Reading from filePath:%@",path); NSMutableData *data=[[NSMutableData alloc]init]; //Put info to save in data [data writeToFile:path atomically:YES]; </code></pre> <p>I've checked in the iphone's console, and when loading the info It print's a directory that looks normal(I don't have the device here so I can't post the exact directory) , and then I see a deny file-write-create error like this:</p> <pre><code>unknown sandboxd[1332] &lt;Notice&gt;: AppName(1328) deny file-write-create </code></pre> <p>When I have acces to the device again (tomorrow) I'll update the post with the exact directory printed. Any Idea why this happens?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload