[英]Objective-C NSInvalidArgumentException
I have a segemented control with three choices, each choice does a different calculations. 我有一个带有三个选择的分段控件,每个选择执行不同的计算。 The calculations are doing manipulating strings.
这些计算正在处理字符串。
I notice that when I first start the app, the strings are nil, btw. 我注意到,当我第一次启动该应用程序时,字符串为nil,顺便说一句。 If I touch all three options on the segmented control, the app will crash, and here is the stack trace.
如果我触摸分段控件上的所有三个选项,则应用程序将崩溃,这是堆栈跟踪。
I've searched everywhere but can't find the problem still. 我到处搜索过,但仍然找不到问题。
[Session started at 2011-02-25 01:21:03 -0500.]
2011-02-25 01:21:07.075 tipApp[2184:207] -[_UIStretchableImage isEqualToString:]: unrecognized selector sent to instance 0x4b5c0a0
2011-02-25 01:21:07.078 tipApp[2184:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[_UIStretchableImage isEqualToString:]: unrecognized selector sent to instance 0x4b5c0a0'
*** Call stack at first throw:
(
0 CoreFoundation 0x00db7be9 __exceptionPreprocess + 185
1 libobjc.A.dylib 0x00f0c5c2 objc_exception_throw + 47
2 CoreFoundation 0x00db96fb -[NSObject(NSObject) doesNotRecognizeSelector:] + 187
3 CoreFoundation 0x00d29366 ___forwarding___ + 966
4 CoreFoundation 0x00d28f22 _CF_forwarding_prep_0 + 50
5 tipApp 0x00006f13 -[tipAppViewController exact] + 56
6 tipApp 0x00006ed3 -[tipAppViewController mirror] + 4772
7 tipApp 0x000057f2 -[tipAppViewController segmentedControlIndexChanged] + 104
8 UIKit 0x002c0a6e -[UIApplication sendAction:to:from:forEvent:] + 119
9 UIKit 0x0034f1b5 -[UIControl sendAction:to:forEvent:] + 67
10 UIKit 0x00351647 -[UIControl(Internal) _sendActionsForEvents:withEvent:] + 527
11 UIKit 0x0034f16c -[UIControl sendActionsForControlEvents:] + 49
12 UIKit 0x0038e6b2 -[UISegmentedControl setSelectedSegmentIndex:] + 574
13 UIKit 0x0039317e -[UISegmentedControl touchesBegan:withEvent:] + 971
14 UIKit 0x002e5025 -[UIWindow _sendTouchesForEvent:] + 395
15 UIKit 0x002c637a -[UIApplication sendEvent:] + 447
16 UIKit 0x002cb732 _UIApplicationHandleEvent + 7576
17 GraphicsServices 0x016eda36 PurpleEventCallback + 1550
18 CoreFoundation 0x00d99064 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 52
19 CoreFoundation 0x00cf96f7 __CFRunLoopDoSource1 + 215
20 CoreFoundation 0x00cf6983 __CFRunLoopRun + 979
21 CoreFoundation 0x00cf6240 CFRunLoopRunSpecific + 208
22 CoreFoundation 0x00cf6161 CFRunLoopRunInMode + 97
23 GraphicsServices 0x016ec268 GSEventRunModal + 217
24 GraphicsServices 0x016ec32d GSEventRun + 115
25 UIKit 0x002cf42e UIApplicationMain + 1160
26 tipApp 0x00002888 main + 102
27 tipApp 0x00002819 start + 53
)
terminate called after throwing an instance of 'NSException'
[Session started at 2011-02-25 01:26:59 -0500.]
It looks like in your -[tipAppViewController exact]
method you are sending the isEqualToString:
selector to an object that does not handle it. 看起来在
-[tipAppViewController exact]
方法中,您正在将isEqualToString:
选择器发送给不处理它的对象。
If that's not helpful, maybe post the code for the exact
method. 如果那没有帮助,请发布
exact
方法的代码。
Can you post the code for the segmented control? 您可以发布分段控件的代码吗? Are you trying to go through the subviews on a UIScrollview?
您是否要遍历UIScrollview上的子视图? That may cause the exception to thrown.
这可能会引发异常。 Check out:
查看:
http://wiresareobsolete.com/wordpress/2010/03/uiscrollview-has-a-secret/ http://wiresareobsolete.com/wordpress/2010/03/uiscrollview-has-a-secret/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.