Consider the following objective-C++ code
- (BOOL)application:(UIApplication *)application
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
try
{
throw std::logic_error("error message");
}
catch (const std::exception& ex)
{
NSLog(@"%s", ex.what());
}
return YES;
}
In XCode 6.2 it is working as expected ("error message" is logged). However since we upgraded to 6.3, the throwing line (throw std::logic_error...
) raises SIGABRT
(the stack trace only contains _cxa_throw
and _pthread_kill
beyond applicationdidFinishLaunchingWithOptions
) and crashes the application.
This only happens in our application - when I copy the exact same code to a new project everything works well, even with identical compiler flags.
I've tried specifying -fexceptions
and -fnon-call-exceptions
to no avail (same behavior).
Update It seems this only happens on 32-bit simulators (it works on actual devices and 64-bit simulators).
Update 2 We narrowed it down to the UserVoice iOS SDK. The behavior is clearly displayed in a new vanilla project simply by linking against it (make sure you call some method so that linkage takes place). We haven't investigated what exactly in that library causes it yet, and we also have some internal libraries that provoke the same behavior (but they should be irrelevant to anyone outside Microsoft).