سؤال

When i run my app i have this exception

[NSDecimalNumber stringByTrimmingCharactersInSet:]: unrecognized selector sent to instance 0xcd7b1e0

but the problem is that i don't use a NSDecimalNumber object and i don't use the stringByTrimmingCharactersInSet method in any part of my app.

The app crash in the allocation of this navigation controller

UINavigationController *navCont = [[UINavigationController alloc] initWithRootViewController:controller];

If i search the instance reported in the exception i can't find it

This is the full stack crash:

*** First throw call stack:
(
0   CoreFoundation                      0x036985e4 __exceptionPreprocess + 180
1   libobjc.A.dylib                     0x0341b8b6 objc_exception_throw + 44
2   CoreFoundation                      0x03735903 -[NSObject(NSObject) doesNotRecognizeSelector:] + 275
3   CoreFoundation                      0x0368890b ___forwarding___ + 1019
4   CoreFoundation                      0x036884ee _CF_forwarding_prep_0 + 14
5   UIKit                               0x0221e9c2 -[UINavigationItem initWithTitle:] + 143
6   UIKit                               0x022b0f89 -[UIViewController(UINavigationControllerItem) navigationItem] + 192
7   UIKit                               0x022c5736 __71-[UINavigationController pushViewController:transition:forceImmediate:]_block_invoke + 121
8   UIKit                               0x022c4f6e -[UINavigationController _executeNavigationHandler:deferred:] + 112
9   UIKit                               0x022c5680 -[UINavigationController pushViewController:transition:forceImmediate:] + 1475
10  UIKit                               0x022c50b5 -[UINavigationController pushViewController:animated:] + 325
11  UIKit                               0x022b37d7 -[UINavigationController initWithRootViewController:] + 122
12  AppsBuilder_iOS_7                   0x0006bfaf -[FixedGrid_ipad_ViewController itemSelected:] + 703
13  AppsBuilder_iOS_7                   0x000123fb -[AppDelegate startApp_iPad] + 4955
14  AppsBuilder_iOS_7                   0x0000ff23 -[AppDelegate startApp] + 83
15  AppsBuilder_iOS_7                   0x0001385e -[AppDelegate authenticationUser] + 2366
16  AppsBuilder_iOS_7                   0x0000febd -[AppDelegate finishJsonDowload:] + 621
17  AppsBuilder_iOS_7                   0x000d9602 +[JSONDownloader loadAppInfoJsonFromUrl:withDestination:] + 2418
18  AppsBuilder_iOS_7                   0x0000fc45 -[AppDelegate setAppInfos] + 661
19  libobjc.A.dylib                     0x0342d81f -[NSObject performSelector:withObject:] + 70
20  Foundation                          0x030709d8 __NSThreadPerformPerform + 285
21  CoreFoundation                      0x0362183f __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 15
22  CoreFoundation                      0x03621295 __CFRunLoopDoSources0 + 437
23  CoreFoundation                      0x0363e29e __CFRunLoopRun + 910
24  CoreFoundation                      0x0363dac3 CFRunLoopRunSpecific + 467
25  CoreFoundation                      0x0363d8db CFRunLoopRunInMode + 123
26  GraphicsServices                    0x050ea9e2 GSEventRunModal + 192
27  GraphicsServices                    0x050ea809 GSEventRun + 104
28  UIKit                               0x02189d3b UIApplicationMain + 1225
29  AppsBuilder_iOS_7                   0x0006f742 main + 130
30  libdyld.dylib                       0x03e2c70d start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
هل كانت مفيدة؟

المحلول

You're probably passing a NSNumber somewhere in your app, where a NSString was expected.

Common places for this are UIAppearance or NSDictionaries, but it can happen anywhere. The stack trace would help.

See similar problem: Initialization of UISwitch causes unrecognized selector exception in iOS 6

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top