gpt4 book ai didi

cocoa - "+[NSTimer scheduledTimerWithTimeInterval:repeats:block:]: unrecognized selector"微不足道的错误

转载 作者:行者123 更新时间:2023-12-03 16:09:53 27 4
gpt4 key购买 nike

在迁移到 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);
}];
}

链接包括(核心)Foundation 类和“all_load”。一定是一些完全微不足道的事情 - 但失败了。

感谢任何和所有帮助。

谢谢

Dw。

最佳答案

+[NSTimer ScheduledTimerWithTimeInterval:repeats:block:] 是 iOS 10.0+ 方法。您是否尝试在 iOS 9.x 上运行它?

https://developer.apple.com/reference/foundation/nstimer/2091889-scheduledtimerwithtimeinterval?language=objc

关于cocoa - "+[NSTimer scheduledTimerWithTimeInterval:repeats:block:]: unrecognized selector"微不足道的错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40521799/

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