开发者

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. 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.

If that's not helpful, maybe post the code for the exact method.


Can you post the code for the segmented control? Are you trying to go through the subviews on a UIScrollview? That may cause the exception to thrown. Check out:

http://wiresareobsolete.com/wordpress/2010/03/uiscrollview-has-a-secret/

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜