我正在制作两个 iPad 应用程序,它们与一个文件进行通信并从一个文件中获取所有数据。我搜索并找到这个“containerURLForSecurityApplicationGroupIdentifier”,我们可以创建组并存储在其中。我写了下面的代码。在权利文件中我写
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.security.app-sandbox</key>
<true/>
<key>com.apple.security.application-groups</key>
<array>
<string>$(TeamIdentifierPrefix)com.xxx.catalogapp.Coredata</string>
</array>
<key>keychain-access-groups</key>
<array>
<string>$(AppIdentifierPrefix)com.xxx.catalogapp.Coredata</string>
</array>
</dict>
</plist>
在代码中我写了这个
NSFileManager* fileManager = [NSFileManager defaultManager];
NSURL* storeUrl = [fileManager
containerURLForSecurityApplicationGroupIdentifier:@"com.xxx.catalogapp.Coredata"];
NSLog(@"%@", storeUrl);
但我得到了 storeUrlnil
value.
Xcode6(目前处于测试版)强制共享文件夹 ID 以“group”开头。
通过以下 URL 与 Xcode6/iOS8 两个测试版共享我的 CoreData 存储对我有用。
NSFileManager* fileManager = [NSFileManager defaultManager];
NSURL* storeUrl = [fileManager containerURLForSecurityApplicationGroupIdentifier:@"group.XXX"];
一旦 Xcode6 发布,stevesliva 链接的文档似乎就会过时
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)