error writing to plist

Posted by Najeebullah Shah on Stack Overflow See other posts from Stack Overflow or by Najeebullah Shah
Published on 2011-11-29T11:12:06Z Indexed on 2011/11/29 17:49 UTC
Read the original article Hit count: 281

Filed under:
|
|
[array writeToFile:[documentsDirectory stringByAppendingPathComponent:@"data.plist" atomically:YES];

this line gives error that method -stringByAppendingPathComponent not found. whats the issue

NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSArray *array = [[NSArray alloc]initWithObjects:@"First", @"Second", @"Third", nil];
[array writeToFile:[documentsDirectory stringByAppendingPathComponent:@"data.plist" atomically:YES]];

© Stack Overflow or respective owner

Related posts about iphone

Related posts about objective-c