Mark Szymanski
Mark Szymanski

Reputation: 58090

iPhone app not making file in device but works in simulator

I have an app and it stores data to a .plist file in the resources group in Xcode (if that matters). And whenever I run it on the simulator it works perfectly with the file. On the iPhone, however, it doesn't seem to be interacting with the file.

Thanks in advance!

Upvotes: 0

Views: 475

Answers (2)

kovpas
kovpas

Reputation: 9593

Here's an example of how to get Documents directory path, you should write any user data there:

NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];

Upvotes: 1

Ole Begemann
Ole Begemann

Reputation: 135548

You cannot write to the application bundle on the device. It is read-only. You have to write your file to your app's Documents folder.

Upvotes: 4

Related Questions