【问题标题】:NSDate distantFutureNSDate 遥远的未来
【发布时间】:2012-11-09 17:21:20
【问题描述】:

我有一个关于 [NSDate distinctFuture] 的问题,我是这样使用的:

while (_connection != nil)
    {
        [[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSData distantFuture]];
    }

我收到警告“找不到类方法 '+distantFuture'(返回类型默认为 'id')”。我运行代码,出现错误:-[NSConcreteData timeIntervalSinceReferenceDate]: unrecognized selector sent to instance 0x80d18e0

* 由于未捕获的异常“NSInvalidArgumentException”而终止应用程序,原因:“-[NSConcreteData timeIntervalSinceReferenceDate]:无法识别的选择器发送到实例 0x80d18e0” * 首先抛出调用栈: (0x1e63022 0x1606cd6 0x1e64cbd 0x1dc9ed0 0x1dc9cb2 0x10af3e1 0x72181 0x11300ad 0x18a9330 0x18aa439 0x95707b24 0x957096fe) 终止称为抛出异常。 我使用 [NSDate dateWithTimeIntervalSinceNow:2],错误是一样的。 有人可以帮助我吗?非常感谢。

【问题讨论】:

    标签: nsdate nsrunloop operation


    【解决方案1】:

    NSData 不是 NSDate。尝试:[NSDate distinctFuture] 代替。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-10-06
      • 2016-05-05
      • 1970-01-01
      • 1970-01-01
      • 2021-06-23
      相关资源
      最近更新 更多