如何解决问题:''实例方法'-arrayByPerformingSelector:'找不到(返回类型默认为'id')" [英] how to resolve the issue: "'Instance method '-arrayByPerformingSelector:' not found (return type defaults to 'id')"

查看:120
本文介绍了如何解决问题:''实例方法'-arrayByPerformingSelector:'找不到(返回类型默认为'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.

研究一下,你需要:

•下载 NSArray + PerformSelector.h NSArray + PerformSelector.m 来自这里

•将它们添加到你的xcode项目中

•添加 #importNSArray + 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.

这篇关于如何解决问题:''实例方法'-arrayByPerformingSelector:'找不到(返回类型默认为'id')"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆