gpt4 book ai didi

ios - swift 中的 timeIntervalSince1970 属性在哪里

转载 作者:行者123 更新时间:2023-11-29 01:44:29 38 4
gpt4 key购买 nike

我正在尝试获取当前毫秒数,根据 Google 上的所有问题,我应该使用 NSDate 的 timeIntervalSince1970 属性

但是我已经这样做了:

var startTime = NSData()
and then
startTime. timeIntervalSince1970

and
startTime. timeIntervalSince1970()

但是好像已经没有属性(property)了,对吧?

如果是,请问替换的是什么?

最佳答案

错误是:NSDate 而不是 NSData
另外“.”后面不应该有空格?

var 开始时间 = NSDate()让间隔 = startTime.timeIntervalSince1970

来自 Apple 文档:

var timeIntervalSince1970: NSTimeInterval { get }

This property’s value is negative if the date object is earlier than January 1, 1970 at 12:00 a.m. GMT.

关于ios - swift 中的 timeIntervalSince1970 属性在哪里,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32083681/

38 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com