2
我正在爲我的iOS應用使用CloudKit。我創建了一個按ID刪除記錄的方法。無法刪除CloudKit中的記錄
我的問題是,我重新安裝應用程序後不會刪除CKRecord
:當我重新安裝應用程序並嘗試刪除CloudKit記錄時,該方法成功執行(錯誤爲零),但記錄仍在CloudKit中。
PS:只要刪除由同一應用程序實例創建的記錄,刪除工作正常。
class func removeFavoriteEntryFromCloud(favoriteID id: String) {
//Create the record
let favoriteID = CKRecordID(recordName: id)
privateDatabase.deleteRecordWithID(favoriteID) { (id: CKRecordID?, error: NSError?) -> Void in
if error == nil {
print("successfuly deleted record", id ?? "nil")
}
}
}
這裏是我的角色在儀表板:
當然,我用的是同一個iCloud用戶帳戶爲我的測試設備上。
這是CloudKit開發環境中的錯誤嗎?
我在文檔中找到了這個句子「如果您使用即時模式來填充具有記錄的數據庫,如如通過保存記錄創建數據庫架構中所述,您可以在應用運行之間重置開發環境。「 [link](https://developer.apple.com/library/mac/documentation/DataManagement/Conceptual/CloudKitQuickStart/EditingSchemesUsingCloudKitDashboard/EditingSchemesUsingCloudKitDashboard.html)也許開發環境是這樣設計的:我需要在測試期間重置我的區域。 – Romain