1

编译时收到以下错误消息:

2011-11-27 14:59:32.049 Storyboard[12104:f803] -[TargetViewController setPeople:]:unrecognized selector sent to instance 0x6d50310
2011-11-27 14:59:32.051 Storyboard[12104:f803] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[TargetViewController setPeople:]: unrecognized selector sent to instance 0x6d50310'
*** First throw call stack:
(0x13c5052 0x1556d0a 0x13c6ced 0x132bf00 0x132bce2 0x2877 0x1a9d6 0x1b8a6 0x2a743 0x2b1f8 0x1eaa9 0x12affa9 0x13991c5 0x12fe022 0x12fc90a 0x12fbdb4 0x12fbccb 0x1b2a7 0x1ca9b 0x2508 0x2465)
terminate called throwing an exception

有趣的是,我的 TargetViewController 甚至没有“人”属性 (NSMutableArray)。

我的应用程序的结构是我有一个带有 tableView 的 tabbarcontroller,它有一个 detailView,在第二个选项卡中是一个带有弹出框的普通视图(targetVieController)。

(你可能会看到我用故事板设置了整个东西,这也是我的应用程序的名称。

快速帮助表示赞赏!


编辑

也许我应该补充一点,一旦应用程序开始加载,编译器就会抛出错误……</p>

按照 Michaels 和 MrMusic 的建议,我在我的呼叫堆栈中搜索人员并得到以下信息:

_cmd = SEL 0x6eae setPeople:(我认为这只是一个有断点的通知)

而且,令人惊讶的是,我有一个包含“人类”的数组,但它们没有显示在另一个选项卡的我的表格视图中。

回溯:

#0  -[TargetViewController setPeople:] (self=0x6891f90, _cmd=0x6e8e, b=0x689a8d0) at /Developer/Projects/Storyboard/Storyboard/TargetViewController.m:73
#1  0x000027c7 in -[CoverdaleAppDelegate application:didFinishLaunchingWithOptions:] (self=0x6a7a650, _cmd=0x4c796a, application=0xad74840, launchOptions=0x0) at /Developer/Projects/Storyboard/Storyboard/CoverdaleAppDelegate.m:44
#2  0x0001a9d6 in -[UIApplication _callInitializationDelegatesForURL:payload:suspended:] ()

#3  0x0001b8a6 in -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] ()
#4  0x0002a743 in -[UIApplication handleEvent:withNewEvent:] ()
#5  0x0002b1f8 in -[UIApplication sendEvent:] ()
#6  0x0001eaa9 in _UIApplicationHandleEvent ()
#7  0x012affa9 in PurpleEventCallback ()
#8  0x013991c5 in __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ ()
#9  0x012fe022 in __CFRunLoopDoSource1 ()
#10 0x012fc90a in __CFRunLoopRun ()
#11 0x012fbdb4 in CFRunLoopRunSpecific ()
#12 0x012fbccb in CFRunLoopRunInMode ()
#13 0x0001b2a7 in -[UIApplication _run] ()
#14 0x0001ca9b in UIApplicationMain ()
#15 0x00002458 in main (argc=1, argv=0xbffff644) at /Developer/Projects/Storyboard/Storyboard/main.m:16
4

2 回答 2

1

在您的项目中搜索“.people”和“setPeople”以查看该NSMutableArray集合的设置位置。验证您是否始终people在适当的对象(具有 people 属性的对象或具有 people 属性的对象的子类)上进行设置。

编辑:某处试图设置人员集合。如果搜索“.people”和“setPeople”字面上什么都没有返回,那么也许 IB 或 StoryBoard 中的某些东西正试图设置人。我最初的想法是某些视图控制器错误地具有 TargetViewController 类型并试图设置人员(也许您说myViewController.people = ...myViewController 的类型错误。

于 2011-11-27T16:55:19.297 回答
0

您可能在某处有内存泄漏。任何具有 setPeople 方法的类都可能没有在某处正确保留。

于 2011-11-27T17:11:26.723 回答