我想出了如何检索登录用户的first/lastName.有没有办法获得AppleID?!
var defaultContainer = CKContainer.defaultContainer()
var publicDatabase = defaultContainer.publicCloudDatabase
defaultContainer.discoverUserInfoWithUserRecordID(recordID, {userInfo, error in
println("firstName: \(userInfo.firstName?) lastName: \(userInfo.lastName?)")
})
Run Code Online (Sandbox Code Playgroud) 我已经为启用了CloudKit的2个App ID创建了2个容器.但是,当我访问CloudKit仪表板时,它说我没有任何支持CloudKit的应用程序?有什么问题?
我有一个很棒的应用程序创意,但我是一个不太有经验的开发人员,所以我不知道这是否可能,我正在考虑一个应用程序,每个人都有一个唯一的用户名链接到他们的 iCloud 帐户(一种简单的方法来找到像 snapchat 这样的朋友) 并且每个用户都可以创建任务,前提是他们必须指定他们想要挑战的目标、奖励和用户名。我该如何开始?是否可以?该死的我有这么多问题我已经有一个小客户但我不确定它是否与云套件兼容
谢谢
我需要一种方法将CKQueryNotification连接到CKRecord或CKSubscription,这样我就可以在多种记录类型上接收更新/插入/删除.我成功收到CKNotifications,这是有效载荷:
{
ck = {
ce = 2;
cid = "<my cloud container id>";
nid = "<unknown guid>";
qry = {
dbs = 2;
fo = 1;
rid = "<the record id>";
sid = "<THIS IS THE SUBSCRIPTION ID>";
zid = "_defaultZone";
zoid = "_defaultOwner";
};
};
}
Run Code Online (Sandbox Code Playgroud)
我可以通过通知有效负载获取订阅ID,我可以将订阅ID绑定到知道记录类型的本地缓存,但我想使用CKFetchNotificationChangesOperation来检索未读通知,此时我只有一个CKQueryNotification对象.
CKQueryNotification对象只有一个CKRecordID,据我所知,我无法从CKRecordID获得CKRecord.我可以在我的容器中对我的所有CKRecord-> recordType执行查询,但这似乎不对.
任何帮助表示赞赏!
如何CKRecord在客户端以编程方式从我的数据库中删除 a 。
for record in records {
if recordNumber < 13 {
let moodRecord:CKRecord = record as! CKRecord
self.moodArray.append(moodRecord.objectForKey("Color") as! String)
}
else if recordNumber > 13 {
// DELETE RECORD HERE
record.delete(CKRecord)
recordNumber--
}
recordNumber++
}
Run Code Online (Sandbox Code Playgroud) 我想对应用程序进行屏幕截图,但是当它在生产模式和模拟器中运行时。是否可以?或者必须像在生产模式下一样在开发模式下构建相同的数据集?
我使用以下CKNotification Info,这似乎工作正常:
CKNotificationInfo *note = [[CKNotificationInfo alloc] init];
note.alertBody = @"Something Happened";
note.shouldBadge = NO;
note.shouldSendContentAvailable = NO;
当iOS设备上的内容发生变化时,我的Mac应用会根据此通知的订阅收到推送通知.但是,didReceiveRemoteNotification从未调用过,因此我无法处理该事件.我需要能够刷新并获取新的更改.我怎么做?
嗨,所有CloudKit用户:
我有一个可怕的时间试图找出为什么CKDatabaseOperation不给出任何反馈.CKRecords在蜂窝上保存时没有错误,也没有回调.
能告诉我你对此有何看法?
最初,我试图将CLLocation另存为NSUserDefault值,然后再将其存储为CKRecord在CLoudkit中,但是出现错误:“ defaults.setObject(locationRecord.recordID,forKey:“ locationRecordID”)“,原因是“试图将非属性列表对象设置为键locationRecordID “ 的NSUserDefaults / CFPreferences值。因此,现在我尝试将lat和long保存为默认值,并替换Cloudkit中的旧位置。我当前在“ publicDB.fetchRecordWithID((defaults.objectForKey(“ Location”)as!CKRecordID),completionHandler: “ 行上收到“ Thread 1 SIGABRT ”错误,原因是“ 无法转换类型为'__NSCFDictionary'的值(0x1a1bec968)为“ CKRecordID”。”
func locationManager(manager: CLLocationManager, didUpdateLocations locations: [CLLocation])
{
let location = locations.last
self.loc1 = location!
let center = CLLocationCoordinate2D(latitude: location!.coordinate.latitude, longitude: location!.coordinate.longitude)
let region = MKCoordinateRegion(center: center, span: MKCoordinateSpan(latitudeDelta: 0.004, longitudeDelta: 0.004))
self.mapView.setRegion(region, animated: true)
self.locationManager.stopUpdatingLocation()
self.locationManager.startMonitoringSignificantLocationChanges()
self.getRecordToUpdate(locations)
let lat: CLLocationDegrees = center.latitude
self.lat1 = lat
let long: CLLocationDegrees = center.longitude
self.long1 = long
locationRecord.setObject(location, forKey: "location")
let publicData = CKContainer.defaultContainer().publicCloudDatabase
publicData.saveRecord(locationRecord) { …Run Code Online (Sandbox Code Playgroud) 我对iCloud很新 - 我制作了一个容器,然后在其中创建了一个Record Type.然后部署到生产.
好吧,我不再需要这种记录类型了,所以我试着删除它.
Invalid attempt to delete a record type which is active in a production container.
Run Code Online (Sandbox Code Playgroud)
好吧,似乎我不能从Production中删除它.
也许如果我在开发环境中使用红色重置按钮,它会让我清除生产中的数据?
will be revert to the version in the production environment
Run Code Online (Sandbox Code Playgroud)
这不会对我有所帮助 - 我该怎么做呢?当然有一种方法可以消除记录类型而不创建一个全新的容器?