When an error appears on the user's device, the app logs the error description and the callstack on a remote server :
// Build the error string
NSString *error = [@"some error happened\n" stringByAppendingString:[NSThread callStackSymbols]];
// Log the error
NSLog(@"%@", error);
// Set up the web service address with param containing the error string
NSURL *url = [NSURL URLWithString:"https://myServer.com/myLoggerWebService?_error=error"];
// Send request to the server
id response = [NSString stringWithContentOfURL:url encoding:NSUTF8StringEncoding error:nil];
So when I look at the logs in XCode, I get a classic callstack containing all methods (with their understandable name) called before the error occured :
0 MyAppName 0x00000001014a1b3b -[GlobalFunctions prepareQuery:withStatement:] + 315 1 MyAppName 0x00000001014a3b7e -[GlobalFunctions insertIntoWithQuery:] + 78 2 MyAppName 0x00000001014a3ab9 -[GlobalFunctions insertInto:fields:values:] + 1417 3 MyAppName 0x0000000101488f67 -[Evenement save] + 3287 4 MyAppName 0x00000001014055c1 -[SyncElement saveOrUpdateWithPK:tableName:] + 241 5 MyAppName 0x0000000101485073 +[Evenement syncDownload:] + 1251 6 MyAppName 0x0000000101403228 +[SyncElement sync:] + 40 7 MyAppName 0x000000010141150b __61+[Sync syncClassesWithIndex:check:syncType:doBlockOnSuccess:]_block_invoke + 123 8 MyAppName 0x00000001014e8af8 __77+[MBProgressHUD(utils) initWithText:detailTxt:doBlock:onFinish:hideOnFinish:]_block_invoke + 56 9 MyAppName 0x000000010152bf88 __40+[BlockHelper doBlock:onQueue:onFinish:]_block_invoke + 56 10 libdispatch.dylib 0x0000000106ddde5d _dispatch_call_block_and_release + 12 11 libdispatch.dylib 0x0000000106dfe49b _dispatch_client_callout + 8 12 libdispatch.dylib 0x0000000106de6bef _dispatch_root_queue_drain + 1829 13 libdispatch.dylib 0x0000000106de64c5 _dispatch_worker_thread3 + 111 14 libsystem_pthread.dylib 0x000000010712f4f2 _pthread_wqthread + 1129 15 libsystem_pthread.dylib 0x000000010712d375 start_wqthread + 13
But when I look at the logs on the remote server, I get this useless callstack, without the method names :
0 MyAppName 0x00000001001612bc MyAppName + 479932 1 MyAppName 0x0000000100162e28 MyAppName + 486952 2 MyAppName 0x0000000100162b7c MyAppName + 486268 3 MyAppName 0x000000010015a854 MyAppName + 452692 4 MyAppName 0x000000010015a4dc MyAppName + 451804 5 MyAppName 0x000000010015a3cc MyAppName + 451532 6 MyAppName 0x000000010015a2cc MyAppName + 451276 7 MyAppName 0x0000000100103a40 MyAppName + 96832 8 MyAppName 0x000000010010ceb8 MyAppName + 134840 9 MyAppName 0x0000000100103d88 MyAppName + 97672 10 MyAppName 0x00000001001b395c MyAppName + 817500 11 MyAppName 0x00000001001b30dc MyAppName + 815324 12 libdispatch.dylib 0x00000001952e1994 <redacted> + 24 13 libdispatch.dylib 0x00000001952e1954 <redacted> + 16 14 libdispatch.dylib 0x00000001952ec0a4 <redacted> + 1448 15 libdispatch.dylib 0x00000001952e4a5c <redacted> + 132 16 libdispatch.dylib 0x00000001952ee318 <redacted> + 720 17 libdispatch.dylib 0x00000001952efc4c <redacted> + 108 18 libsystem_pthread.dylib 0x00000001954c121c _pthread_wqthread + 816 19 libsystem_pthread.dylib 0x00000001954c0ee0 start_wqthread + 4
Does someone know why ? If so, is there a way to log the readable callstack (i.e. the first one) on the remote server ?