gpt4 book ai didi

ios - CloudKit - 无法从 iCloud 检索数据

转载 作者:行者123 更新时间:2023-11-30 13:09:17 25 4
gpt4 key购买 nike

当应用程序 (iOS9) 通过 Xcode 运行或从 App Store 下载时,通过 CloudKit 从 iCloud 发送和接收数据有什么区别吗?

我的问题是:从Xcode启动的应用程序成功接收并显示数据,在App Store中发布的同一应用程序无法显示数据...

哪里可能出现错误?

谢谢。

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 仪表板将开发环境迁移到生产环境

关于ios - CloudKit - 无法从 iCloud 检索数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38916527/

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