我有一个使用iPod Library API访问iOS中歌曲数据库的应用程序.随着iTunes Match的发布,任何不在设备上的歌曲都将无法加载.有没有办法要求下载这首歌?也许使用新的iCloud API?
编辑: 要明确我不会问如何使用iPhone下载iTunes Match歌曲.iOS SDK允许通过MPMediaQuery/MPMediaItems访问iPod库.在具有iTunes Match功能的iOS设备上,通过MPMediaQuery返回iTunes匹配库中但不在设备本地的歌曲,但MPMediaItems的'exportable'标志设置为false.当我在音乐应用程序中访问这些歌曲时,它们会自动下载.我想通过MPMediaItem触发相同的自动下载.
我已经看到iTunes Match中的项目被视为iCloud的一部分,并且iOS 5 SDK中有一个新的iCloud部分.但据我了解,我只能上传我的应用程序数据.我希望通过MPMediaItem或通过iCloud使用URL来触发iTunes Match下载.
我正在开发一个支持iCloud的应用程序,用户可以通过iCloud Drive导入和导出文件.在浏览iCloud Drive时,无论是使用UIDocumentPickerViewController(iOS 8)还是Finder(OS X Yosemite),我都可以看到其他支持iCloud-Drive的应用创建/拥有的目录,例如Automator,Keynote或TextEdit.
我希望我们的应用程序也能在iCloud Drive中公开其无处不在的文档目录,但还未能弄明白.在上述某些应用程序的Info.plist文件中,我发现了这个密钥:
<key>NSUbiquitousContainers</key>
<dict>
<key>com.apple.TextEdit</key>
<dict>
<key>NSUbiquitousContainerIsDocumentScopePublic</key>
<true/>
<key>NSUbiquitousContainerSupportedFolderLevels</key>
<string>Any</string>
</dict>
</dict>
Run Code Online (Sandbox Code Playgroud)
这些密钥也在这里记录,但我没有找到更广泛主题的任何其他文档.编辑/注意:虽然它不包含我的问题的答案,但文档选择器编程指南是一个有用的资源.
我已经尝试将上述键/值添加到我们的应用程序,但没有看到任何影响.我注意到/尝试过的事情:
对于第三方应用程序,iCloud容器以这种方式构建:iCloud.$(CFBundleIdentifier).我不确定为什么TextEdit只使用纯包标识符,但对于我们的标识符,我尝试了两种方法,即有和没有iCloud.前缀.我还认识到你需要对包标识符进行硬编码(即,不要使用iCloud.$(CFBundleIdentifier)),因为只有PLIST的值似乎在构建时解析,而不是键.
我以编程方式(to <containerPath>/Documents)添加了一个子目录,因此容器不为空.但是,这并不重要,因为所有其他应用程序的目录最初都是空的.
出现在iCloud Drive中的某些Apple应用程序中没有这些条目Info.plist,例如Numbers和Pages.
iCloud设置正确,我可以使用返回的URL以编程方式查看ubiquity容器[[NSFileManager defaultManager] URLForUbiquityContainerIdentifier:nil];.
我登录到启用了iCloud Drive的iCloud帐户.我可以看到我的iCloud Drive内容UIDocumentPickerViewController.
我使用iOS 8 beta 5模拟器(和Yosemite beta 5来查看Mac上的iCloud Drive目录)(编辑/注意:这同样适用于beta 6)
这就是我的Entitlements文件的样子(仅限相关部分)
<key>com.apple.developer.icloud-container-identifiers</key>
<array>
<string>iCloud.$(CFBundleIdentifier)</string>
</array>
<key>com.apple.developer.icloud-services</key>
<array>
<string>CloudDocuments</string>
</array>
<key>com.apple.developer.ubiquity-container-identifiers</key>
<array/>
Run Code Online (Sandbox Code Playgroud)
我已经在Capabilities部分使用Xcode的UI进行了设置.我不明白为什么最后一个键没有条目,但添加<string>iCloud.$(CFBundleIdentifier)</string>没有帮助.相反,它使Xcode在Capabilities UI中抱怨,所以我删除了它.编辑/注意: …
我试图让iCloud与我的应用程序一起工作,如果用户请求,它需要将现有的本地存储迁移到无处不在的商店.
经过围绕Apple开发论坛和其他地方的一些关注之后,我采用了这种方法,这种方法并不一致.我实际上看到它工作,但只有在设备B(从iCloud填充)几次崩溃后.
- (NSPersistentStoreCoordinator *)persistentStoreCoordinator {
if (persistentStoreCoordinator != nil)
return persistentStoreCoordinator;
NSURL *legacyStoreUrl = [NSURL fileURLWithPath:[[self applicationDocumentsDirectory] stringByAppendingPathComponent:[self activeStoreFilenameUpgraded:NO]]];
NSURL *upgradedStoreUrl = [NSURL fileURLWithPath:[[self applicationDocumentsDirectory] stringByAppendingPathComponent:[self activeStoreFilenameUpgraded:YES]]];
persistentStoreCoordinator = [[NSPersistentStoreCoordinator alloc] initWithManagedObjectModel:[self managedObjectModel]];
if ((IOS_VERSION_GREATER_THAN_OR_EQUAL_TO(@"5.0")) && (self.iCloudEnabled)) {
NSPersistentStoreCoordinator* psc = persistentStoreCoordinator;
NSFileManager *fileManager = [NSFileManager defaultManager];
NSDictionary *cloudOptions = nil;
NSDictionary *localOptions = [NSDictionary dictionaryWithObjectsAndKeys:
[NSNumber numberWithBool:YES], NSMigratePersistentStoresAutomaticallyOption,
[NSNumber numberWithBool:YES], NSInferMappingModelAutomaticallyOption,
nil];
NSURL *cloudURL = [fileManager URLForUbiquityContainerIdentifier:@"<CONTAINER ID>"];
NSString *coreDataCloudContent = [[cloudURL path] stringByAppendingPathComponent:[NSString stringWithFormat:@"logs%d",[self activeStoreIndex]]];
if ([coreDataCloudContent …Run Code Online (Sandbox Code Playgroud) 我正在开发一个核心数据应用程序,并考虑添加iCloud支持,但在网上浏览后,我经常听说iCloud + CoreData不可靠,并且经常会破坏.
这是真的?我正在阅读一本关于核心数据主题的书,提到iCloud + CoreData在iOS 5中不可靠,但后来已经修复,但我也听到了相反的情况,iCloud + CoreData在iOS 6中仍然不可靠.如果是这样的话自定义格式的数据库有帮助吗?
任何帮助将不胜感激.
有没有办法让我检查并查看用户在打开应用程序时是否登录到iCloud?如果他们没有登录,我希望能够将他们引导到设置页面,如果他们登录到iCloud并且之前使用过该应用程序 - 我想跳过登录页面....
我查看了Apple的iCloud和Cloudkits文档,但无法找到任何有用的东西!这甚至可能吗?
我在尝试让iCloud与我的应用程序一起工作时遇到了一些麻烦.我在这里尝试了Tim Roadley的例子,但是当应用程序通过Xcode启动时,仍然会显示下面的日志(同步确实很简单,但现在已经停止工作).
[PFUbiquityBaseline metadataFromCurrentBaselineForStoreWithName:modelVersionHash:andUbiquityRootLocation:withError:](1091):
CoreData: Ubiquity: Didn't get baseline metadata back from metadata url:
file://localhost/private/var/mobile/Library/Mobile%20Documents/<TEAM
ID>~samburnstone~Staff-Manager/Logs/.baseline/current.nosync/<TEAM
ID>.samburnstone.StaffManager/g9TNo_uNFuNyltbjcAmDaFE7wl~6a2eGmW6uKIZCC1s=
/baseline.meta Error: (null)
Run Code Online (Sandbox Code Playgroud)
(TEAM ID是我在Apple会员中心可以找到的字母数字序列)
如果有人知道可能导致这种情况的原因,我将非常感激.
谢谢!
我正在尝试将应用转移到另一个Apple ID.当我这样做时,我收到一个错误,说应用程序无法传输,因为应用程序启用了iCloud.
由于这不是故意的,我试图禁用iCloud并向应用程序提交更新.要做到这一点我:
但是,我仍然无法转移更新的应用程序,仍然会收到iCloud启用的应用程序无法传输的错误.
有谁知道这是否可以修复 - 或者是完全删除应用程序并重新开始的情况?
我正在尝试使用iCloud Drive打开,修改和保存文件UIDocument.当我打电话save(to:for:completionHandler:)与文件的位置和使用.forOverwriting的UIDocumentSaveOperation,它的状态完成success = true.但是,iCloud文件(如桌面和iOS文件浏览器中所示)不会更新,重新打开文件时,不会显示更改.我已验证contents(forType:)在保存时返回正确(修改)的文件内容.
(注意:我已经看过这个问题了,但它没有太大帮助)
以下是相关的代码部分:
MainViewController.swift:
var saveFile: SBDocument?
@IBAction func bbiOpen_pressed(_ sender: UIBarButtonItem) {
if saveFile == nil {
let importMenu = UIDocumentMenuViewController(documentTypes: self.UTIs, in: .import)
importMenu.delegate = self
importMenu.popoverPresentationController?.barButtonItem = bbiOpen
self.present(importMenu, animated: true, completion: nil)
} else {
willClose()
}
}
func willClose(_ action: UIAlertAction?) {
if saveFile!.hasUnsavedChanges {
dlgYesNoCancel(self, title: "Save Changes?", message: "Would you like to save the changes to …Run Code Online (Sandbox Code Playgroud) 我的用例是:
问题:
iClould会保留属于已删除应用的用户数据吗?(根据我的实验,当我的应用程序被删除时,数据会保留在iCloud上,但是,我不确定该行为是否正式).
如果答案是肯定的,那么我有以下问题:
一个.用户的数据最终如何从用户的iCloud存储中删除/清除?(我担心的是,如果用户决定再也不使用我的应用程序,那么数据就会变得无用,因此应该在iCloud上清空以释放空间)
湾 如果用户决定重新下载我的应用程序,他如何才能访问他最初上传的数据iCloud?
C.我可以从iCloud门户网站(www.icloud.com)管理用户的数据吗?我没有看到我上传的文档出现在iCloud门户网站中,即使我将我的文件放在"Documents"子文件夹下.
d.是否有描述此行为的官方文档?
提前致谢!
我想设置Do not back up为我的文件夹Document Directory.
我找到了"不备份"的代码,但我如何验证文件夹是否已标记.
icloud ×10
ios ×7
core-data ×3
iphone ×2
objective-c ×2
swift ×2
apple-id ×1
cloudkit ×1
cocoa-touch ×1
core-audio ×1
entitlements ×1
icloud-api ×1
info-plist ×1
ios4 ×1
ios8 ×1
ipod ×1
save ×1
uidocument ×1