Reputation:
I'm trying to create a timeStamp for sent/received messages to store inside of my database (firebase) and I'm not sure if I'm going about it correctly. Here's the line of code thats giving me an error:
Previously, I would write:
let timeStamp: NSNumber = Int(NSDate().timeIntervalSince1970))
but I'm getting the same error:
"Argument labels '(_:)' do not match any available overloads"
Upvotes: 0
Views: 1383
Reputation: 318794
You can't assign an Int
value to an NSNumber
variable. You need to create an NSNumber
from the Int
. And you need to specify the parameter label:
let timeStamp: NSNumber = NSNumber(value: Int(NSDate().timeIntervalSince1970)))
Of course you now don't need to specifically state the data type:
let timeStamp = NSNumber(value: Int(NSDate().timeIntervalSince1970)))
Upvotes: 2