且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在今日扩展中保存和加载数据(iOS 8)

更新时间:2023-12-01 22:53:52

你需要使用app group identifier而不是com。*
例如:

You need to use app group identifier instead of com.* For instance:

NSUserDefaults *shared = [[NSUserDefaults alloc]initWithSuiteName:@"group.company.appgroup"];

存储数据时不要忘记同步

Don't forget to synchronise when you store data

[shared synchronize];