Read/Write on Plist file without using the iPhone SImulator?
Posted
by Silent
on Stack Overflow
See other posts from Stack Overflow
or by Silent
Published on 2010-06-05T21:02:31Z
Indexed on
2010/06/05
22:12 UTC
Read the original article
Hit count: 161
Hello all,
i am using an example from the iphone developer book from apress. the problem is that this example only works on the simulator im trying to figure out how i can make it work on the device. This chapter isn't working at all. below is the sample code. data.plist is located in the resource folder.
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
return [documentsDirectory stringByAppendingPathComponent:kFilename];
Below then checks to see if the file is located. this is skipped, so im guessing this does not find the file.
if ([[NSFileManager defaultManager]fileExistsAtPath:filePath]) {
NSArray *array = [[NSArray alloc] initWithContentsOfFile:filePath];
BGDataSave = [array objectAtIndex:0];
NSLog(@"%@", BGDataSave);
price.text = [array objectAtIndex:1];
percent.text = [array objectAtIndex:2];
salepriceLabel.text = [array objectAtIndex:3];
origpriceLabel.text = [array objectAtIndex:4];
}
© Stack Overflow or respective owner