Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Sui Jen

macrumors newbie
Original poster
Oct 14, 2009
13
0
Hi,

I can write file into simulator but can't write file into iPhone.

This is how I write file:
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];

// the path to write file
NSString *appFile = [documentsDirectory stringByAppendingPathComponent:mad:"myFile"];

[data writeToFile:appFile atomically:YES];

Is this because of the Apple certification problem? Or is there any other reason that cause the application unable to write file into iPhone?

Regards,
Rachel
 

skunkworker

macrumors regular
Sep 9, 2007
182
20
It would have nothing to do with the "apple certification problem". How do you know that it is not being created on the device? are you doing a dump of the application's directory from the organizer?
 

xsmasher

macrumors regular
Jul 18, 2008
140
0
What type of object is "data" ? I tested your code on the phone and it worked fine with an NSData. Should work with strings, arrays, dicts too. Maybe data is nil, or your loading code is broken?
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.