NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults]; if ( ![userDefaults valueForKey:@"version"] ) { // CALL your Function; // Adding version number to NSUserDefaults for first version: [userDefaults setfloat:[[[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundLeversion"] floatValue] forKey:@"version"]; } if ([[NSUserDefaults standardUserDefaults] floatForKey:@"version"] == [[[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundLeversion"] floatValue] ) { /// Same Version so dont run the function } else { // Call Your Function; // Update version number to NSUserDefaults for other versions: [userDefaults setfloat:[[[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundLeversion"] floatValue] forKey:@"version"]; }总结
以上是内存溢出为你收集整理的objective-c – 仅在第一次运行ios时执行功能全部内容,希望文章能够帮你解决objective-c – 仅在第一次运行ios时执行功能所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)