首页 > 代码库 > ios8 创建plist

ios8 创建plist

+ (NSString *)getFilePath

{

    NSString *path = [[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,NSUserDomainMask,YES) objectAtIndex:0] stringByAppendingPathComponent:@"photo.plist"];

    if ([[NSFileManager defaultManager] fileExistsAtPath:path] == NO)

    {

        NSFileManager* fileManager = [NSFileManager defaultManager];

        //if(IOS7)

        [fileManager createFileAtPath:@"photo.plist" contents:nil attributes:nil];

        //if(IOS8)

        [fileManager createFileAtPath:path contents:nil attributes:nil];

        NSMutableArray *photoPathArray = [NSMutableArray array];

        [photoPathArray writeToFile:path atomically:YES];

    }

    return path;

}


ios8 创建plist