[英]CloudKit - Can't retrieve the data from iCloud
Is there any difference in sending and receiving data from iCloud via CloudKit
when the application (iOS9) runs through Xcode or when it is downloaded from the App Store? 当应用程序(iOS9)通过Xcode运行或从App Store下载时,通过CloudKit
从iCloud发送和接收数据有什么区别吗?
My problem is: Application launched from Xcode receives and displays data successfully, the same app published in the App Store can not display the data... 我的问题是:从Xcode启动的应用程序成功接收并显示数据,在App Store中发布的同一应用程序无法显示数据...
In what could be the mistake? 这可能是什么错误?
Thank you. 谢谢。
func getRecordsFromCloud() {
// Fetch data using Convenience API
let cloudContainer = CKContainer.defaultContainer()
let publicDatabase = cloudContainer.publicCloudDatabase
let predicate = NSPredicate(value: true)
let query = CKQuery(recordType: "Pivo", predicate: predicate)
query.sortDescriptors = [NSSortDescriptor(key: "creationDate", ascending: false)]
// Create the query operation with the query
let queryOperation = CKQueryOperation(query: query)
queryOperation.desiredKeys = ["name", "type", "location"]
queryOperation.queuePriority = .VeryHigh
queryOperation.resultsLimit = 50
queryOperation.recordFetchedBlock = { (record:CKRecord!) -> Void in
if let restaurantRecord = record {
self.restaurants.append(restaurantRecord)
}
}
queryOperation.queryCompletionBlock = { (cursor:CKQueryCursor?, error:NSError?) -> Void in
if (error != nil) {
print("Failed to get data from iCloud - \(error!.localizedDescription)")
return
}
print("Successfully retrieve the data from iCloud")
self.refreshControl?.endRefreshing()
NSOperationQueue.mainQueue().addOperationWithBlock() {
self.spinner.stopAnimating()
self.tableView.reloadData()
}
}
// Execute the query
publicDatabase.addOperation(queryOperation)
}
您需要使用CloudKit仪表板将开发环境迁移到生产环境
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.