gpt4 book ai didi

ios - 发送到实例的无法识别的选择器

转载 作者:行者123 更新时间:2023-11-28 22:02:52 24 4
gpt4 key购买 nike

所以我正在查看堆栈溢出,我看到很多这些无法识别的选择器发送到实例错误消息。一些 ARC 相关,大多数与 ARC 无关。我实际上正在做的是调用 NSTimer 每 6 秒调用一个方法来更改照片数组的文件路径。 (如果您愿意,可以使用自动横幅。)6 秒后,我收到此错误消息:

2014-07-10 11:04:35.152 ysysy[435:57924] -[TableViewController animateFunction]: unrecognized selector sent to instance 0x156989f0
2014-07-10 11:04:35.154 ysysy[435:57924] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[TableViewController animateFunction]: unrecognized selector sent to instance 0x156989f0'

我在 viewWllAppearMethod 中调用了一个 setBannerTimer 方法:

[self performSelectorOnMainThread:@selector(setBannerTimer) withObject:nil waitUntilDone:NO];

setBannerTimer 然后每 6 秒触发一个名为 animate 函数的字符串方法:

- (void) setBannerTimer {


self->bannerTimer = [NSTimer scheduledTimerWithTimeInterval:6 target:self selector:@selector(animateFunction) userInfo:nil repeats:YES];
}

动画功能:

 +(NSString *)animateFunction

return photoPath;
}

希望我把我的问题摆出来让大家容易理解。我一定是在用我的方法做一些语法错误的事情吧?我是如此接近!提前致谢!

最佳答案

这与 ARC 无关,scheduledTimerWithTimeInterval:target:selector:userInfo:repeats 应该有一个实例方法选择器,不是类方法

=>调用一个

- (NSString *)animateFunction

而不是

+ (NSString *)animateFunction

关于ios - 发送到实例的无法识别的选择器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24681595/

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