Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/103.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 提供具有核心数据价值的应用程序_Ios_Core Data - Fatal编程技术网

Ios 提供具有核心数据价值的应用程序

Ios 提供具有核心数据价值的应用程序,ios,core-data,Ios,Core Data,在delivert上预加载包含核心数据的应用程序的标准方法是什么,例如,我想在交付应用程序时附带一个示例文档,该文档在安装后通过核心数据提供 那么,如何使用Core data iOS应用程序打包一些初始数据呢?您可以检测首次启动,然后添加数据: - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { if ([[NSUser

在delivert上预加载包含核心数据的应用程序的标准方法是什么,例如,我想在交付应用程序时附带一个示例文档,该文档在安装后通过核心数据提供


那么,如何使用Core data iOS应用程序打包一些初始数据呢?

您可以检测首次启动,然后添加数据:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    if ([[NSUserDefaults standardUserDefaults] boolForKey:@"HasLaunchedOnce"])
    {

    }
    else
    {
      NSUserDefaults *prefs = [NSUserDefaults standardUserDefaults];
        [prefs setBool:YES forKey:@"HasLaunchedOnce"];

        [[NSUserDefaults standardUserDefaults] synchronize];
        //Add your data here in the Core Data Database.
    }

    return YES;
}
可能的副本请参见:。