1

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

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

我收到警告“找不到类方法'+distantFuture'(返回类型默认为'id')”。我运行代码,错误:-[NSConcreteData timeIntervalSinceReferenceDate]:无法识别的选择器发送到实例 0x80d18e0

* Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSConcreteData timeIntervalSinceReferenceDate]: unrecognized selector sent to instance 0x80d18e0' * First throw call stack: (0x1e63022 0x1606cd6 0x1e64cbd 0x1dc9ed0 0x1dc9cb2 0x10af3e1 0x72181 0x11300ad 0x18a9330 0x18aa439 0x95707b24 0x957096fe) terminate called throwing一个例外。我使用 [NSDate dateWithTimeIntervalSinceNow:2],错误是一样的。有人可以帮助我吗?多谢。

4

1 回答 1

5

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

于 2012-11-09T17:23:49.843 回答