Hello everyone,
I reported the following piece of code error:
SomeTables [2553:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '- [NSCFString setFrame:]: unrecognized selector sent to instance 0x4b52550'
In fact, I wrote the code did not setFrame this method. The call stack is a systematic approach, after repeated errors in fact look at the code found here, the return value is wrong, I wrote a callback function:
- (UIView *) tableView: (UITableView *) tableView viewForHeaderInSection: (NSInteger) section; {
return [keys objectAtIndex: section];
}
I mistakenly put a non UIView's object returned.
But this is wrong, I have read many times in the code after the find, I ask you, is there a way to find the cause of this error from zombie, memory, stack it?
Thank you.
Reply:
Their own roof. . .
Reply:
Set a breakpoint on the exception, stop on objective-c exceptions
Reply:
Here is my stack information, darkdong can say specific? Thank you ~
2011-07-28 17:21:18.709 SomeTables [953:207] - [NSCFString setFrame:]: unrecognized selector sent to instance 0x4b69ac0
2011-07-28 17:21:18.752 SomeTables [953:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '- [NSCFString setFrame:]: unrecognized selector sent to instance 0x4b69ac0'
*** Call stack at first throw:
(
0 CoreFoundation 0x00ec7be9 __ exceptionPreprocess + 185
1 libobjc.A.dylib 0x00cbc5c2 objc_exception_throw + 47
2 CoreFoundation 0x00ec96fb - [NSObject (NSObject) doesNotRecognizeSelector:] + 187
3 CoreFoundation 0x00e39366 ___ forwarding___ + 966
4 CoreFoundation 0x00e38f22 _CF_forwarding_prep_0 + 50
5 UIKit 0x0032664e - [UITableView (UITableViewInternal) _sectionHeaderView: withFrame: forSection: opaque: reuseViewIfPossible:] + 279
6 UIKit 0x0031b84a - [UITableView (UITableViewInternal) _sectionHeaderViewWithFrame: forSection: opaque: reuseViewIfPossible:] + 93
7 UIKit 0x00333cd2 - [UITableView (_UITableViewPrivate) _updateVisibleHeadersAndFootersNow:] + 2033
8 UIKit 0x003306fb - [UITableView (_UITableViewPrivate) _updateVisibleCellsNow:] + 2244
9 UIKit 0x00328538 - [UITableView layoutSubviews] + 242
10 QuartzCore 0x01c66451 - [CALayer layoutSublayers] + 181
11 QuartzCore 0x01c6617c CALayerLayoutIfNeeded + 220
12 QuartzCore 0x01c5f37c _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 310
13 QuartzCore 0x01c5f0d0 _ZN2CA11Transaction6commitEv + 292
14 UIKit 0x002b419f - [UIApplication _reportAppLaunchFinished] + 39
15 UIKit 0x002b4659 - [UIApplication _runWithURL: payload: launchOrientation: statusBarStyle: statusBarHidden:] + 690
16 UIKit 0x002bedb2 - [UIApplication handleEvent: withNewEvent:] + 1533
17 UIKit 0x002b7202 - [UIApplication sendEvent:] + 71
18 UIKit 0x002bc732 _UIApplicationHandleEvent + 7576
19 GraphicsServices 0x016dea36 PurpleEventCallback + 1550
20 CoreFoundation 0x00ea9064 __ CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 52
21 CoreFoundation 0x00e096f7 __ CFRunLoopDoSource1 + 215
22 CoreFoundation 0x00e06983 __ CFRunLoopRun + 979
23 CoreFoundation 0x00e06240 CFRunLoopRunSpecific + 208
24 CoreFoundation 0x00e06161 CFRunLoopRunInMode + 97
25 UIKit 0x002b3fa8 - [UIApplication _run] + 636
26 UIKit 0x002c042e UIApplicationMain + 1160
27 SomeTables 0x00002370 main + 102
28 SomeTables 0x00002301 start + 53
)
terminate called after throwing an instance of 'NSException'
Reply:
When your goal is to not abnormal, the program stops at the place where the exception occurred yet
Then the anomaly there is an option to set a breakpoint xcode3 stop on objective-c exceptions, when such an exception occurs, the program stops at the wrong code, you will be able to know where the wrong
Reply:
< br />
Thank you for your reply.
I set the stop on objective-c exceptions in the system, but still to no avail. . . Look carefully to find that all systems function stack, no write their own, so there is no way the system may stop at this line exception above.
Reply:
1 libobjc.A.dylib 0x00cbc5c2 objc_exception_throw + 47
This line is throwing an exception, if you set a breakpoint, it should be triggered.
Confirm the application is running in debug mode, and see the breakpoint has been set up in objc_exception_throw libobjc.A.dylib tick
Reply:
Reply:
NSInvalidArgumentException This is illustrated by the class-shaped guide often it does not, then play fight reported the wrong location on ok it!
Reply:
Obviously, this method returns a uiview, and you certainly return NSString type, 80% are of this type, if you want the title to be changed to specify header addition methods
No comments:
Post a Comment