首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >iCloud文档不可见

iCloud文档不可见
EN

Stack Overflow用户
提问于 2014-10-10 16:36:12
回答 2查看 9.1K关注 0票数 14

我正在尝试使用iCloud文档来存储我的iOS应用程序中的XML文件。一切似乎都很好(我可以没有错误地写入和读取文件),除了我的应用程序的文件不显示在iCloud文件,既不在icloud.com或developer.icloud.com或在我的Windows电脑上的iCloud驱动器文件夹。我在模拟器中运行该应用程序,并在真实设备上使用TestFlight进行测试。我安装了Windows4.0的最新版本的iCloud。应用程序是用Xcode6创建的。

有人知道如何在iCloud文档中显示这些文件吗?

我用来保存文件的代码:

代码语言:javascript
复制
NSLog(@"Syncing with iCloud");
    NSURL *ubiq = [filemgr URLForUbiquityContainerIdentifier:nil];
    if (ubiq) {
        NSURL *ubiquitousPackage = [ubiq URLByAppendingPathComponent:@"Documents" isDirectory:YES];
        if ([filemgr fileExistsAtPath:[ubiquitousPackage path]] == NO)
            [filemgr createDirectoryAtURL:ubiquitousPackage
              withIntermediateDirectories:YES
                               attributes:nil
                                    error:nil];

        ubiquitousPackage = [ubiquitousPackage URLByAppendingPathComponent:@"data.pxa"];

        DataFile *file = [[DataFile alloc] initWithFileURL:ubiquitousPackage];
        file.xmlContent = doc.XMLString;
        [file saveToURL:[file fileURL] forSaveOperation:UIDocumentSaveForCreating | UIDocumentSaveForOverwriting completionHandler:^(BOOL success) {

            if (success) {
                NSLog(@"Synced with iCloud: %@", [ubiquitousPackage path]);

            } else {
                NSLog(@"Syncing with iCloud failed");
            }
        }];
    } else {
        NSLog(@"iCloud not available");
    }
EN

回答 2

Stack Overflow用户

发布于 2015-05-06 22:22:01

我发现了问题所在: iCloud容器的Info.plist中的键与格式"iCloud.com.example.MyApp“略有不同。

票数 5
EN

Stack Overflow用户

发布于 2015-05-06 20:33:58

我按照此link的说明在iCloudDrive中查看我的应用程序创建的文件。我可以从设备上看到settings>iCloud>Storage中的文件。希望能有所帮助。

票数 -2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/26295176

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档