且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在Swift中包含服务器端的时间戳

更新时间:2023-11-27 22:04:10

尝试 [CreatedAt:[.sv: timestamp] ...]

该键的保存值必须是这样的:1464103942351


Before firebase improvements I could post timestamps in any struct like

let usermsg =  ["CreatedAt":FirebaseServerValue.timestamp(), "ChatTitle":msg.ChatTitle,"ChatBody":msg.ChatBody,  "Owner":self.GoogleUserID]

But after FIRServerValue.timestamp() became ( NSDictionary *) I could not get timestamp to post as a value to the database.

Try ["CreatedAt": [".sv": "timestamp"]...]
The saved value for that key must be something like: 1464103942351