客户端的com.apple.developer.ubiquity-container-identifiers权利不允许使用所请求的容器标识符

时间:2014-09-24 09:46:29

标签: ios core-data ios8 xcode6 icloud

我面临一些问题,我认为我不是唯一的问题。

我在App Store中有一个应用程序,它使用Core DataiCloud来保存用户在用户设备上添加的信息。对此毫无兴趣,而且效果非常好。它是iOS 7应用程序,在iOS 8上也能很好地运行。当我在iOS 8的设备上测试它时。它与Xcode 5.1.1一起工作得非常好,但它与Xcode 6.0.1没有关系。

似乎Apple在iOS 8中使用iCloud改变了一些内容。会话225:" Core Data中的新功能" https://developer.apple.com/videos/wwdc/2014/似乎没有任何改变。

问题

在Developer Portal中,看起来我必须创建新的iCloud容器。 (我不知道那是什么或如何摆脱它)。它用" iCloud.bundleID"创建了这个。 - 即前面的iCloud这个词。

在Xcode 6之前,我的权利是:

" xxxxxxxx.com.vital.lope"其中xxxxxxx是我的TeamID。

现在,在功能窗格中,没有iCloud核心数据选项(但根据选择适当存储API下的https://developer.apple.com/library/prerelease/iOS/documentation/General/Conceptual/iCloudDesignGuide/Chapters/iCloudFundametals.html#//apple_ref/doc/uid/TP40012094-CH6-SW28,iCloud Documents也用于核心数据)。没关系。

我已选择使用自定义容器:

enter image description here

原因?好吧,因为在我的代码中,在App Delegate中,我有:

// Returns the URL to our Ubiquity Folder
- (NSURL *)grabCloudPath:(NSString *)filename {

    NSFileManager *fileManager = [NSFileManager defaultManager];
    NSString *teamID = @"xxxxxxxxx"; // replace with your real Team ID
    NSString *bundleID = [[NSBundle mainBundle]bundleIdentifier];
    NSString *cloudRoot = [NSString stringWithFormat:@"%@.%@", teamID, bundleID];

    NSURL *cloudRootURL = [fileManager URLForUbiquityContainerIdentifier:cloudRoot];

    NSString *pathToCloudFile = [[cloudRootURL path]stringByAppendingPathComponent:@"Documents"];
    pathToCloudFile = [pathToCloudFile stringByAppendingPathComponent:filename];

    return [NSURL fileURLWithPath:pathToCloudFile];
}

从persistentStoreCoorindator调用。同样,这在Xcode 6之前很有效。

如果我在Xcode 6.0.1中运行我的应用程序,则会向用户显示打开iCloud的选项。如果他们这样做,应用程序崩溃时出现以下错误:

The operation couldn’t be completed. (LibrarianErrorDomain error 11 - The requested container identifier is not permitted by the client's com.apple.developer.ubiquity-container-identifiers entitlement.)" 
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[NSURL initFileURLWithPath:]: nil string parameter'

如果我运行异常断点,它会在上面grabCloudPath代码的return语句中崩溃。

在那种方法中,如果我改变

NSString *cloudRoot = [NSString stringWithFormat:@"%@.%@", teamID, bundleID];

NSString *cloudRoot = [NSString stringWithFormat:@"iCloud.%@.%@", teamID, bundleID];

该应用程序不再崩溃,但之后没有iCloud数据进入,因为它现在是一个不同的文件夹。

回到功能窗格,我有:

enter image description here

这表明没有错误,但这也是在我没有做任何事情的情况下自动发生的。

我学到的东西

在观看WWDC 2014的会议225之后,我可以看到我应该仍然使用iCloud核心数据而且应该没有变化。但是,该选项在“功能”窗格中不存在。

enter image description here

我知道我没有使用CloudKit,或者应该将CloudKit用于我的应用程序,因为它不是同一个要求。我在WWDC视频中观看CloudKit会话后了解到了这一点。

问题

主要问题是:

1)我需要iCloud容器吗? 2)为什么我不能继续使用我用我的应用创建的相同容器? 3)如果我需要使用iCloud容器,如何将数据从现有容器(xxxxxxx.com.vital.lope)传输到新的iCloud容器(iCloud.xxxxxxx.com.vital.lope)。 4)我是否在iCloud的Developer Portal中使用CloudKit对Xcode 5的支持或支持?

enter image description here

更新

我回到开发者门户网站,删除了我的应用程序ID的云容器并选择使用Xcode 5.当我重新添加我的配置文件时,我的应用程序在同一个地方崩溃了。如果我在“功能”窗格中更改为使用默认容器,则我的应用程序在同一位置崩溃。

我希望这个问题有道理,我无法想象我是唯一一个面临这个问题的人,但我很感激任何指导。

0 个答案:

没有答案
相关问题