NSString *userPlist = [NSString stringWithFormat:@"%@/xxxxx.plist",NSHomeDirectory()];
NSFileManager *fileManager = [NSFileManager defaultManager];
//如果沙盒中的DOC目录中没有数据文件
if (![fileManager fileExistsAtPath:userPlist]) {
//创建系统配置文件
NSMutableDictionary *userDict = [[NSMutableDictionary alloc] init];
NSMutableDictionary *dict = [[NSMutableDictionary alloc]init];
[dict setObject:@"0" forKey:@"guide"];
[userDict setObject:dict forKey:@"data"];
[userDict writeToFile:userPlist atomically:YES];
}
NSString *userPlistObject = [NSString stringWithFormat:@"%@/xxxxx.plist",NSHomeDirectory()];
//文件返回字典
NSMutableDictionary *userPlistDict = [[NSMutableDictionary alloc]initWithContentsOfFile:userPlistObject];
NSDictionary *dataDict = [userPlistDict objectForKey:@"data"];
if ([[dataDict objectForKey:@"guide"]isEqualToString:@"0"]) {
NSLog(@"first time enter");//第一次启动
NSString *userPlist = [NSString stringWithFormat:@"%@/xxxxx.Plist",NSHomeDirectory()];
//文件返回字典
NSMutableDictionary *userPlistDict = [[NSMutableDictionary alloc]initWithContentsOfFile:userPlist];
NSMutableDictionary *dataDic = [userPlistDict objectForKey:@"data"];
[dataDic setObject:@"1" forKey:@"guide"];
[userPlistDict setObject:dataDic forKey:@"data"];
[userPlistDict writeToFile:userPlist atomically:YES];
[self addPagePhotoView];//加载引导页
}
return YES;
第一次启动应用时,加载引导页问题
最新推荐文章于 2017-07-04 10:15:01 发布