如何解决问题:“'Instance method '-arrayByPerformingSelector:' not found (return type defaults to 'id')"; [英] how to resolve the issue: "'Instance method '-arrayByPerformingSelector:' not found (return type defaults to 'id')"
问题描述
我在一个帖子中看到 -(id)arrayByPerformingSelector
接口中的声明应该做,但是当我尝试它时,此声明被视为单独的方法,并且出现了不完整的实现问题......抱歉,这很我问的是一个愚蠢的疑问,但我是 iOS 的新手,无法找出这有什么问题..
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..
self.segmentedControl = [[UISegmentedControl alloc] initWithItems:[viewControllers arrayByPerformingSelector:@selector(title)]];
self.segmentedControl.segmentedControlStyle = UISegmentedControlStyleBar;
而且当我运行项目线程时,SIGABRT 和控制台窗口中的线程停止
and also when i run the project thread stops with SIGABRT and in console window
"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 :):)
推荐答案
我检查了 iOS SDK,但找不到具有该名称的方法.考虑到它会使应用程序崩溃……没有具有该名称的方法.
I checked the iOS SDK and couldn't find a method with that name. 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?, but the accepted answer there references a blog.
研究这个,你需要:
• 从 这里
• 将它们添加到您的 xcode 项目
• 将 #import "NSArray+PerformSelector.h"
添加到您遇到崩溃的 .m 文件中.
Researching that, you will need to:
• download NSArray+PerformSelector.h and NSArray+PerformSelector.m from here
• add them to your xcode project
• add #import "NSArray+PerformSelector.h"
to the .m file you are experiencing your crash in.
这篇关于如何解决问题:“'Instance method '-arrayByPerformingSelector:' not found (return type defaults to 'id')";的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!