BennyKJohnson / OpenCloudKit

Open Source CloudKit Framework
MIT License
96 stars 17 forks source link

Support for NSDate record property #4

Closed malhal closed 7 years ago

malhal commented 7 years ago

movieRecord["timestamp"] = NSDate()

Saving results in:

"serverErrorCode"
      - .1 : BAD_REQUEST
      - .0 : "reason"
      - .1 : Invalid value, expected type TIMESTAMP.

I would guess the NSDate isn't being converted to the correct JSON.

malhal commented 7 years ago

The bug was CKRecord.swift line 391 the TIMESTAMP should be milliseconds, from the docs

Date/Time Number A date or time value. Represented as a number in milliseconds since epoch.

Fix is to multiply timeIntervalSince1970 by 1000