迁移到 10.12/Sierra 和 Xcode 8.1 后,我遇到了一个奇怪的错误:
+[NSTimer scheduledTimerWithTimeInterval:repeats:block:]:
unrecognized selector sent to class 0x7fff78f1fa88
重现此情况的最少代码(创建新项目的默认设置)是:
// AppDelegate.m
//
#import "AppDelegate.h"
@interface AppDelegate ()
@property (weak) IBOutlet NSWindow *window;
@property (strong, nonatomic) NSTimer * timer;
@end
@implementation AppDelegate
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
self.timer = [NSTimer scheduledTimerWithTimeInterval:10
repeats:YES
block:^(NSTimer * _Nonnull timer)
{
NSLog(@"Ping from %@", timer);
}];
}
该链接包括(核心)基础类和“all_load”。一定是一些完全微不足道的事情——但失败了。
任何和所有的帮助表示赞赏。
Thanks,
Dw.
+[NSTimer ScheduledTimerWithTimeInterval:repeats:block:] 是一个 iOS 10.0+ 方法。您是否尝试在 iOS 9.x 上运行它?
https://developer.apple.com/reference/foundation/nstimer/2091889-scheduledtimerwithtimeinterval?language=objc https://developer.apple.com/reference/foundation/nstimer/2091889-scheduledtimerwithtimeinterval?language=objc
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)