Take the 2-minute tour ×  Trying to create plist file. but Gets
error in [NSFileManager copyItemAtPath:toPath:error:]: source
path is nil  do someone know why it's happening? Thank you very
much..  AppDelegate.h :  NSArray*pathes=NSSearchPathForDirectori
esInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString*documentDirectory=[pathes objectAtIndex:0];//first dir
in app dir. NSString*path=[documentDirectory
stringByAppendingPathComponent:@"data.plist"];
NSFileManager*filemanager=[NSFileManager defaultManager];
if(![filemanager fileExistsAtPath:path])
NSString*bundle=[[NSBundle mainBundle]pathForResource:@"data"
ofType:@"plist"];//check if plist file exist;      [filemanager
copyItemAtPath:bundle toPath:path error:&error];
NSMutableDictionary*data=[[NSMutableDictionary
alloc]initWithContentsOfFile:path];     NSArray*arr=[[NSArray
alloc]init];     [data setObject:arr forKey:@"arr"];     [data
writeToFile:path atomically:YES]; share|improve this question
add comment  1 Answer  - [NSBundle pathF