从CloudKitlogging中selectcreationDate
我试图用标题和副标题来填充单元格。 标题与字段和细节与CreationDate从logging。
我正在尝试以下,但我得到一个没有成员'ObjectForKey'
var objects = CKRecord
override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell { let reuseIdentifier = "Cell" var cell:UITableViewCell? = tableView.dequeueReusableCellWithIdentifier(reuseIdentifier) as UITableViewCell? if (cell != nil) { cell = UITableViewCell(style: UITableViewCellStyle.Subtitle, reuseIdentifier: reuseIdentifier) } let object = objects[indexPath.row] cell!.textLabel!.text = object.objectForKey("Notes") as? String cell!.detailTextLabel?.text = object.creationDate.objectForKey("Notes") as? String return cell! }
错误来自这一行:
cell!.detailTextLabel?.text = object.creationDate.objectForKey("Notes") as? String
出于某种原因,您正尝试从logging的创builddate(这是一个NSDate
获取“Notes”键。
只需将creationDate
作为NSDate
。 然后使用NSDateFormatter
将date格式化为可以分配给detailTextLabel.text
的string。
- 增加一个CKRecordvariables中的字段值,而不需要读取?
- 将CKAsset保存到CloudKit中的CKRecord会产生错误:“没有收到资产的authToken”
- 带有OR返回错误的NSPredicate
- 如何在CloudKit Dashboard中使用“fetchWithRecordID”自动生成ID?
- cloudkit错误没有为资产收到authToken
- NSUbiquityIdentityDidChangeNotification不起作用?
- 未收到Mac上自定义logging区域的CloudKit推送通知
- 在CloudKit中将logging从开发移到生产?
- 首次使用CloudKit Records创buildNSCache – closures?