Xcode 4.2 debug doesn't symbolicate stack call
Nothing I tried would fix this (tried both compilers, both debuggers, etc.)
After upgrading XCode for the iOS 5 update, no stack traces seemed to work.
However, I have found an effective work-around - creating my own exception handler (which is also useful for other reasons). First, create a function that will handle the error and output it to the console (as well as whatever else you want to do with it):
void uncaughtExceptionHandler(NSException *exception) {
NSLog(@"CRASH: %@", exception);
NSLog(@"Stack Trace: %@", [exception callStackSymbols]);
// Internal error reporting
}
Next, add the exception handler to your app delegate:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
NSSetUncaughtExceptionHandler(&uncaughtExceptionHandler);
// Normal launch stuff
}
That's it!
If this doesn't work, then there are only two possible reasons:
- Something is overwriting your
NSSetUncaughtExceptionHandler
call (there can be only one handler for your entire app). For example, some 3rd party libraries set their own uncaughtExceptionHandler. So, try setting it at the END of yourdidFinishLaunchingWithOptions
function (or selectively disabling 3rd party libraries). Or better yet, set a symbolic break point onNSSetUncaughtExceptionHandler
to quickly see who is calling it. What you may want to do is to modify your current one rather than adding another one. - You're not actually encountering an exception (for example,
EXC_BAD_ACCESS
is not an exception; credit to @Erik B's comments, below)
Xcode 4.2 debugging on a viewDidLoad or viewDidDisappear will end on a EXC_BAD_ACCESS
You must always call through to super
at some point in all of the viewWill...
or viewDid...
methods that you override. For example,
- (void) viewDidDisappear:(BOOL)animated {
NSLog(@"View did disapear");
[super viewDidDisappear:animated];
}
No exception stacktrace in console under Xcode 4.2/iOS 5?
This works:
int main(int argc, char *argv[]) {
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
int retVal = -1;
@try {
retVal = UIApplicationMain(argc, argv, nil, nil);
}
@catch (NSException* exception) {
NSLog(@"Uncaught exception: %@", exception.description);
NSLog(@"Stack trace: %@", [exception callStackSymbols]);
}
[pool release];
return retVal;
}
For ARC:
int main(int argc, char *argv[]) {
int retVal = -1;
@autoreleasepool {
@try {
retVal = UIApplicationMain(argc, argv, nil, nil);
}
@catch (NSException* exception) {
NSLog(@"Uncaught exception: %@", exception.description);
NSLog(@"Stack trace: %@", [exception callStackSymbols]);
}
}
return retVal;
}
Still waiting for some sort of explanation as to why the default dump no longer works and/or why (even more serious) uncaughtExceptionHandler doesn't work. However, apparently this problem only affects the emulator.
update:
It has been pointed out that if you go to Product -> Scheme -> Edit Scheme, select "Run (Debug)", select the "Diagnostics" tab, and click "Log Exceptions", this will restore the missing Xcode default exception logging, possibly (I haven't tried it yet) eliminating the need for the above hack.
Debugging app crashes with iOS Simulator & XCode 4 halts in main() function, not crash source
Go to the breakpoints panel, and add the bottom left, click the + sign and add an "Exception breakpoint".
Exceptions : All
Break : On throw.
That should solve the problem in most cases.
Too much information being presented in Debug Area - Xcode 8
Open:
- => Product
- => Scheme
- => Edit Scheme
- => Select "Run"
- => Second Tab "Argument"
- => Inside Environment Variables press
+
button - => add
Name = OS_ACTIVITY_MODE
& set theValue
todisable
- Press
Close
button
And you are done.
Related Topics
How to Make a Uitextfield Move Up When the Keyboard Is Present - on Starting to Edit
How to Create Delegates in Objective-C
Ios 7 Status Bar Back to iOS 6 Default Style in Iphone App
Exc_Bad_Access Signal Received
Instantiate and Present a Viewcontroller in Swift
How to Input Currency Format on a Text Field (From Right to Left) Using Swift
Performselector May Cause a Leak Because Its Selector Is Unknown
Determine Device (Iphone, Ipod Touch) With Ios
How to Debug 'Unrecognized Selector Sent to Instance' Error
Undefined Symbols For Architecture Armv7
The Simplest Way to Resize an Uiimage
Send and Receive Messages Through Nsnotificationcenter in Objective-C
How to Use Nsjsonserialization
How to Change the Name of an iOS App
How to Load an Http Url With App Transport Security Enabled in iOS 9
Understanding Ibeacon Distancing
How to Access a Specific Field from Cloud Firestore Firebase in Swift