1 - (void)creatPlistFile{ 2 NSArray *array = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask,YES); 3 NSString *path = [array objectAtIndex:0];// 拼接phoneContact.plist时,有的Xcode不加/也行
4 plistPath = [path stringByAppendingString:@"/phoneContact.plist"]; 5 NSFileManager *fileManager = [[NSFileManager alloc]init]; 6 if (![fileManager fileExistsAtPath:plistPath]) { 7 BOOL isOk = [fileManager createFileAtPath:plistPath contents:nil attributes:nil]; 8 if (isOk) { 9 NSLog(@"创建成功"); 10 } 11 else{ 12 NSLog(@"创建失败"); 13 } 14 } 15 }
时间: 2024-10-01 07:00:46