[英]how to resolve the issue: “'Instance method '-arrayByPerformingSelector:' not found (return type defaults to 'id')”
i saw in one post -(id)arrayByPerformingSelector
declaration in interface should do , but when i tried it this declaration was treated as separate method and incomplete implementation issue came... sorry this is quite a silly doubt i am asking but I'm a newbie to iOS and wasn't able to find out whats wrong with this.. 我在接口中的一个帖子-(id)arrayByPerformingSelector
声明中应该看到了,但是当我尝试该声明时,该声明被视为单独的方法,并且出现了不完整的实现问题……抱歉,这是我问的一个很愚蠢的疑问,但是我iOS的新手,却无法找出问题所在。
self.segmentedControl = [[UISegmentedControl alloc] initWithItems:[viewControllers arrayByPerformingSelector:@selector(title)]];
self.segmentedControl.segmentedControlStyle = UISegmentedControlStyleBar;
and also when i run the project thread stops with SIGABRT and in console window 而且当我运行项目线程时,SIGABRT会停止,并且在控制台窗口中
"TableView[866:fe03] -[__NSArrayI arrayByPerformingSelector:]: unrecognized selector sent to instance 0x6e65620
2012-03-07 12:31:16.074 TableView[866:fe03] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSArrayI arrayByPerformingSelector:]: unrecognized selector sent to instance 0x6e65620'"
if i have to use selector in declaration please do tell me how.... Thanks all :):) 如果我必须在声明中使用选择器,请告诉我如何...。谢谢大家:) :)
I checked the iOS SDK and couldn't find a method with that name. 我检查了iOS SDK,找不到具有该名称的方法。 Considering it is making the app crash... there isn't a method with that name. 考虑到它正在使应用程序崩溃...没有使用该名称的方法。
If you get that same type of warning and your app works fine, my answer here would be relevant 如果您收到相同类型的警告,并且您的应用正常运行,那么我在这里的回答就很有意义
I don't know if you got started on this SO question: Implementing my own navigation controller? 我不知道您是否开始以下SO问题: 实现我自己的导航控制器? , but the accepted answer there references a blog. ,但此处接受的答案引用了一个博客。
Researching that, you will need to: 要进行研究,您将需要:
• download NSArray+PerformSelector.h and NSArray+PerformSelector.m from here •从此处下载NSArray + PerformSelector.h和NSArray + PerformSelector.m
• add them to your xcode project •将它们添加到您的xcode项目中
• add #import "NSArray+PerformSelector.h"
to the .m file you are experiencing your crash in. •将#import "NSArray+PerformSelector.h"
添加到您遇到崩溃的.m文件中。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.