[iOS] Added NSException logging.

This commit is contained in:
vng 2013-05-17 02:21:37 +03:00 committed by Alex Zolotarev
parent 8bb6e70721
commit 13a9ebd004

View file

@ -3,10 +3,11 @@
#import <Foundation/NSThread.h>
#include "../../platform/platform.hpp"
#include "../../base/logging.hpp"
//////////////////////////////////////////////////////////////////////////////////
/// Used to trick iOs and enable multithreading support with non-native pthreads
/// Used to trick iOs and enable multithreading support with non-native pthreads.
@interface Dummy : NSObject
- (void) dummyThread: (id) obj;
@end
@ -14,12 +15,23 @@
@implementation Dummy
- (void) dummyThread: (id) obj {}
@end
///////////////////////////////////////////////////////////////////////////////////
/// Used to log NSExceptions.
static void exceptionHandler(NSException * ex)
{
NSArray *stack = [ex callStackSymbols];
NSLog(@"%@", ex.name);
NSLog(@"%@", ex.reason);
NSLog(@"Stack trace: %@", stack);
}
int main(int argc, char * argv[])
{
LOG(LINFO, ("MapsWithMe started, detected CPU cores:", GetPlatform().CpuCores()));
NSSetUncaughtExceptionHandler(&exceptionHandler);
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
Dummy * dummy = [[Dummy alloc] autorelease];