问题描述
我正在制作两个与一个文件通信的iPad应用程序,并从一个文件中获取所有数据。我搜索并找到这个containerURLForSecurityApplicationGroupIdentifier,我们可以在其中创建组和存储。我写了下面的代码。在授权文件中,我写
I am making two iPad app that communicate with one file and fetches all the data from one file. I search and find this "containerURLForSecurityApplicationGroupIdentifier" we can create group and store in that. I have write the code below. In entitlement file i write
<?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>
在Code i中写这个
And in Code i write this
NSFileManager* fileManager = [NSFileManager defaultManager];
NSURL* storeUrl = [fileManager
containerURLForSecurityApplicationGroupIdentifier:@"com.xxx.catalogapp.Coredata"];
NSLog(@"%@", storeUrl);
但是storeUrl我得到 nil
值。
But storeUrl I am getting nil
value.
推荐答案
Xcode6(目前处于测试阶段)强制共享文件夹ID以group开头。
Xcode6 (currently in beta) enforces the shared folder IDs to start with "group."
分享我的CoreData商店适合我使用以下网址,Xcode6 / iOS8都是测试版。
Sharing my CoreData store works for me with the following URL with Xcode6/iOS8 both beta.
NSFileManager* fileManager = [NSFileManager defaultManager];
NSURL* storeUrl = [fileManager containerURLForSecurityApplicationGroupIdentifier:@"group.XXX"];
看来,只要Xcode6发布,stevesliva链接的文档就会过时
It seems the documentation that stevesliva linked will be obsolete as soon as Xcode6 will be released
这篇关于containerURLForSecurityApplicationGroupIdentifier获取nil值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!