gpt4 book ai didi

ios - 无法用 timeIntervalSince1970 初始化 NSTimeInterval

转载 作者:行者123 更新时间:2023-11-28 18:17:35 27 4
gpt4 key购买 nike

我正在尝试使用以下代码初始化 NSTimeInterval:

NSTimeInterval *timeStamp = [[NSDate date] timeIntervalSince1970];

但它不断抛出错误:

Initializing 'NSTimeInterval *' (aka 'double *') with an expression of incompatible type 'NSTimeInterval' (aka 'double')

我该如何解决这个问题?

最佳答案

NSTimerInterval 是原始类型,不是对象类型。不需要指针,就像错误状态一样。你想要:

NSTimeInterval timeStamp = [[NSDate date] timeIntervalSince1970];

关于ios - 无法用 timeIntervalSince1970 初始化 NSTimeInterval,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32027580/

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