gpt4 book ai didi

ios - iCloud 文档不可见

转载 作者:技术小花猫 更新时间:2023-10-29 10:53:08 26 4
gpt4 key购买 nike

我正在尝试使用 iCloud 文档来存储来 self 的 iOS 应用程序的 XML 文件。一切似乎都工作正常(我可以毫无错误地写入和读取文件)除了我的应用程序的文件没有出现在 iCloud 文档中,既没有出现在 icloud.com 中,也没有出现在 developer.icloud.com 中,也没有出现在我的 Windows PC 的 iCloud Drive 文件夹中。我在模拟器中运行应用程序并在真实设备上使用 TestFlight 进行测试。我安装了最新版本的 Windows 4.0 版 iCloud。该应用程序是在 Xcode 6 中创建的。

有谁知道如何让文件出现在 iCloud 文档中?

我用来保存文件的代码:

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");
}

最佳答案

我发现问题是什么:iCloud 容器的 Info.plist 中的键与格式“iCloud.com.example.MyApp”略有不同。

关于ios - iCloud 文档不可见,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26295176/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com