4

Apple rejected my app today, I tried to follow the crash log they sent but I couldn't find the source of the crash, I tested my app on two physical phones: 1- iphone 4 2- iphone 5

and I tested it on xcode simulators: 1-Ipad 2-Ipad Retina 3-Ipad Retina (64-bit)

and it works fine on all of them.

this is what they sent to me

We found that your app crashed on iPad running iOS 7.0.6, which is not in compliance with the App
Store Review Guidelines.

Your app crashed when we:

1) Start the app on a device
2) The app crashes on launch

This occurred when your app was used: 

- On Wi-Fi 
- On cellular network

and this one of the los they sent to me

Incident Identifier: F0618233-A16F-4782-8B79-3A2AE5D8BFF6
CrashReporter Key:   1db6124687c1282286f546adfc3c54dc0d8ed7ce
Hardware Model:      xxx
Process:             taptap [266]
Path:                /var/mobile/Applications/.....
Identifier:          x.x.x
Version:             1.0 (1.0)
Code Type:           ARM (Native)
Parent Process:      launchd [1]

Date/Time:           2014-02-22 14:32:19.271 -0800
OS Version:          iOS 7.0.6 (11B651)
Report Version:      104

Exception Type:  EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Triggered by Thread:  0

Last Exception Backtrace:
(0x2d9bff46 0x3819c6aa 0x2d9bfe88 0x2e347a66 0x8c47c 0x2d982114 0x2d8f6252 0x2e2dbc28 0x301b1f52     
0x3019d4c4 0x3013841a 0x3013771c 0x3019cb38 0x325d5708 0x325d52f2 0x2d98a9da 0x2d98a976 0x2d98914a     
0x2d8f3c22 0x2d8f3a06 0x3019bdd4 0x30197044 0x8fde2 0x386a4ab2)

Thread 0 name:  Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0   libsystem_kernel.dylib          0x3875b1fc __pthread_kill + 8
1   libsystem_pthread.dylib         0x387c4a2e pthread_kill + 54
2   libsystem_c.dylib               0x3870bff8 abort + 72
3   libc++abi.dylib                 0x37a3acd2 abort_message + 70
4   libc++abi.dylib                 0x37a536e0 default_terminate_handler() + 248
5   libobjc.A.dylib                 0x3819c91e _objc_terminate() + 190
6   libc++abi.dylib                 0x37a511c4 std::__terminate(void (*)()) + 76
7   libc++abi.dylib                 0x37a50d28 __cxa_rethrow + 96
8   libobjc.A.dylib                 0x3819c7f2 objc_exception_rethrow + 38
9   CoreFoundation                  0x2d8f3c98 CFRunLoopRunSpecific + 636
10  CoreFoundation                  0x2d8f3a06 CFRunLoopRunInMode + 102
11  UIKit                           0x3019bdd4 -[UIApplication _run] + 756
12  UIKit                           0x30197044 UIApplicationMain + 1132
13  taptap                          0x0008fde2 0x83000 + 52706
14  libdyld.dylib                   0x386a4ab4 start + 0

Thread 1 name:  Dispatch queue: com.apple.libdispatch-manager
Thread 1:
0   libsystem_kernel.dylib          0x3874883c kevent64 + 24
1   libdispatch.dylib               0x38689210 _dispatch_mgr_invoke + 228
2   libdispatch.dylib               0x38688f96 _dispatch_mgr_thread$VARIANT$mp + 34

Thread 2:
0   libsystem_kernel.dylib          0x3875bc7c __workq_kernreturn + 8
1   libsystem_pthread.dylib         0x387c1dc6 _pthread_wqthread + 306
2   libsystem_pthread.dylib         0x387c1c80 start_wqthread + 4

Thread 3:
0   libsystem_kernel.dylib          0x3875bc7c __workq_kernreturn + 8
1   libsystem_pthread.dylib         0x387c1dc6 _pthread_wqthread + 306
2   libsystem_pthread.dylib         0x387c1c80 start_wqthread + 4

Thread 4 name:  WebThread
Thread 4:
0   libsystem_kernel.dylib          0x3875afa8 __psynch_mutexwait + 24
1   libsystem_pthread.dylib         0x387c1f0a _pthread_mutex_lock + 302
2   WebCore                         0x35a6f7f0 _WebTryThreadLock(bool) + 104
3   WebCore                         0x35a6f772 WebRunLoopLock(__CFRunLoopObserver*, unsigned long,        
void*) + 42
4   CoreFoundation                  0x2d98b1ca         
__CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 18
5   CoreFoundation                  0x2d988b6c __CFRunLoopDoObservers + 280
6   CoreFoundation                  0x2d988f7c __CFRunLoopRun + 932
7   CoreFoundation                  0x2d8f3c22 CFRunLoopRunSpecific + 518
8   CoreFoundation                  0x2d8f3a06 CFRunLoopRunInMode + 102
9   WebCore                         0x35a6e266 RunWebThread(void*) + 414
10  libsystem_pthread.dylib         0x387c3c1a _pthread_body + 138
11  libsystem_pthread.dylib         0x387c3b8a _pthread_start + 98
12  libsystem_pthread.dylib         0x387c1c8c thread_start + 4

Thread 5:
0   libsystem_kernel.dylib          0x38748a8c mach_msg_trap + 20
1   libsystem_kernel.dylib          0x38748888 mach_msg + 44
2   CoreFoundation                  0x2d98a7be __CFRunLoopServiceMachPort + 150
3   CoreFoundation                  0x2d988ee4 __CFRunLoopRun + 780
4   CoreFoundation                  0x2d8f3c22 CFRunLoopRunSpecific + 518
5   CoreFoundation                  0x2d8f3a06 CFRunLoopRunInMode + 102
6   libAVFAudio.dylib               0x2c976584 GenericRunLoopThread::Entry(void*) + 124
7   libAVFAudio.dylib               0x2c96a99c CAPThread::Entry(CAPThread*) + 176
8   libsystem_pthread.dylib         0x387c3c1a _pthread_body + 138
9   libsystem_pthread.dylib         0x387c3b8a _pthread_start + 98
10  libsystem_pthread.dylib         0x387c1c8c thread_start + 4

Thread 6:
0   libsystem_kernel.dylib          0x3875bc7c __workq_kernreturn + 8
1   libsystem_pthread.dylib         0x387c1dc6 _pthread_wqthread + 306
2   libsystem_pthread.dylib         0x387c1c80 start_wqthread + 4

Thread 7 name:  com.apple.NSURLConnectionLoader
Thread 7:
0   libsystem_kernel.dylib          0x38748a8c mach_msg_trap + 20
1   libsystem_kernel.dylib          0x38748888 mach_msg + 44
2   CoreFoundation                  0x2d98a7be __CFRunLoopServiceMachPort + 150
3   CoreFoundation                  0x2d988ee4 __CFRunLoopRun + 780
4   CoreFoundation                  0x2d8f3c22 CFRunLoopRunSpecific + 518
5   CoreFoundation                  0x2d8f3a06 CFRunLoopRunInMode + 102
6   Foundation                      0x2e32e2f2 +[NSURLConnection(Loader) _resourceLoadLoop:] + 314
7   Foundation                      0x2e3a3c82 __NSThread__main__ + 1058
8   libsystem_pthread.dylib         0x387c3c1a _pthread_body + 138
9   libsystem_pthread.dylib         0x387c3b8a _pthread_start + 98
10  libsystem_pthread.dylib         0x387c1c8c thread_start + 4

Thread 8 name:  com.apple.CFSocket.private
Thread 8:
0   libsystem_kernel.dylib          0x3875b440 __select + 20
1   CoreFoundation                  0x2d98e680 __CFSocketManager + 480
2   libsystem_pthread.dylib         0x387c3c1a _pthread_body + 138
3   libsystem_pthread.dylib         0x387c3b8a _pthread_start + 98
4   libsystem_pthread.dylib         0x387c1c8c thread_start + 4

Thread 0 crashed with ARM Thread State (32-bit):
    r0: 0x00000000    r1: 0x00000000      r2: 0x00000000      r3: 0x00002060
    r4: 0x00000006    r5: 0x3a60618c      r6: 0x00000000      r7: 0x27d80594
    r8: 0x1451e760    r9: 0x00000001     r10: 0x00000000     r11: 0x403e0000
    ip: 0x00000148    sp: 0x27d80588      lr: 0x387c4a33      pc: 0x3875b1fc
  cpsr: 0x00000010

how could I get to the cause of this crash log, thanks

B.I.A
  • 700
  • 1
  • 7
  • 20
  • 3
    Test it on a real ipad. – maelswarm Feb 23 '14 at 06:59
  • Have you handled the `NSURLConnection` properly? – Akshat Singhal Feb 23 '14 at 06:59
  • Make sure you don't have any synchronous HTTP connections on the main UI thread. – Daniel Feb 23 '14 at 06:59
  • 4
    You will need to symbolicate the crash log, as described in this answer: http://stackoverflow.com/questions/1460892/symbolicating-iphone-app-crash-reports – Jakob Halskov Feb 23 '14 at 06:59
  • 2
    What Jakob says is good advice! But you can see from this log that the problem is an unhanded Objective-C exception – user1118321 Feb 23 '14 at 07:17
  • Did you implemented a camera in your app? for example AVCam ? – Magyar Miklós Feb 23 '14 at 09:08
  • @Daniel infact i have a synchronous connection running on the main thread, i changed it to an Asynchronous request with its own thread, do think it is the cause of this crash ? – B.I.A Feb 23 '14 at 10:02
  • @Roecrew i dont have a real ipad – B.I.A Feb 23 '14 at 10:03
  • @incmiko no i am not implementing any camera capabilities in this app – B.I.A Feb 23 '14 at 10:05
  • Drop the full crash report into the Xcode organizer to get the Last Exception Backtrace reformatted and symbolicated. It will most likely point directly place in your code where the problem occurs. – Kerni Feb 23 '14 at 15:02
  • Synchronous HTTP connections will definitely bring your app down. If the request(s) take too long they will hang the UI and the OS watchdog will terminate the app after a set timeout. I believe this is what is happening in your case - although I'm not 100% sure. Btw, on Android, creating an HTTP connection on the main thread will automatically throw an exception so that you learn immediately about this type of issue. – Daniel Feb 23 '14 at 18:05
  • @Daniel: Wrong. The crash happens in this case because of an exception inside the app. Not because the app is terminated by the watchdog. If that would be the case, the crash report would not show an exception. – Kerni Feb 23 '14 at 18:25

1 Answers1

6

That Apple isn't providing the Binary Images section in the provided crash report makes it much harder than necessary to find out what the cause is. Without the that information it is not possible to symbolicate the Last Exception Backtrace and find out more automatically.

The reason for the crash is definitely an exception inside the app, it is not because the apps main thread was blocking for too long because in that case the report would not show a Last Exception Backtrace and look very different. But using synchronous networking requests on the main thread should never be done anyway!

So how to find out more about this exception. Since the Binary Images are missing and the symbols for the system calls are already symbolicated, it is hard to find the address ranges for each system framework. But we know the load address from the app looking at the following line:

13  taptap                          0x0008fde2 0x83000 + 52706

So the load address is 0x83000. Now we take the Last Exception Backtrace addresses and search for the ones that are likely belonging to the app:

0x2d9bff46 0x3819c6aa 0x2d9bfe88 0x2e347a66 0x8c47c 0x2d982114 0x2d8f6252 0x2e2dbc28 0x301b1f52     
0x3019d4c4 0x3013841a 0x3013771c 0x3019cb38 0x325d5708 0x325d52f2 0x2d98a9da 0x2d98a976 0x2d98914a     
0x2d8f3c22 0x2d8f3a06 0x3019bdd4 0x30197044 0x8fde2 0x386a4ab2

The ones that should belong to the app are the following:

0x8c47c 0x8fde2

0x8fde2 is the same as in the main thread and will symbolicate to something like

13  taptap                          0x0008fde2 main (main.m:14)

The interesting one is 0x8c47c, which shows up 5th place from top from the exception. To get the symbol for this one, you need the apps dSYM that you submitted to Apple. You'll find it in the organizer Archives tab. Select the app and choose the entry for the app. Right mouse click the item that you used to submit to Apple and choose Show in Finder. Then another right mouse click and choose Show Package Contents. Open the dSYMs folder.

It is unknown which iPad was used and since the Binary Images section is missing we don't know it either (which would show the used architecture and UUID to verify the architecture, binary, and dSYM). So it can be either armv7 or armv7s. The newest iPad mini with retina and the iPad Air use armv7s in 32 bit mode, all other iPads also either use armv7s or armv7. So we have to try both which may return the same results.

Now open a terminal window and type:

`xcrun atos -arch armv7s -l 0x83000 DragInTheDSYMItemFromTheFinderInHere 0x8c47c`

Then use the same if it doesn't make sense and replace armv7s with armv7.

This should give you the class, method, filename and line number where the exception occured in your app. We'll still be missing the exception reason since the crash report doesn't show that and due to missing binary images we can't really symbolicate all the other addresses and use that find out more. Hopefully this will already give an idea.

Once you have that, please update your question with the details.

UPDATE: Now that the binary images where provided, I was able to symbolicate the crash report and get the Last Exception Backtrace symbols. Although without the app symbols, since I obviously don't have the dSYM.

The symbolicated report is available here: http://pastebin.com/An10dUpi

The important frames are the following

Last Exception Backtrace:
0   CoreFoundation                       0x2d9bff46 __exceptionPreprocess + 126
1   libobjc.A.dylib                      0x3819c6aa objc_exception_throw + 32
2   CoreFoundation                       0x2d9bfe88 +[NSException raise:format:] + 98
3   Foundation                           0x2e347a66 +[NSJSONSerialization JSONObjectWithData:options:error:] + 60
4   taptap                               0x8c47c 0x83000 + 38012

This shows that the crash occurs because the app tries to serialize a given NSData object into json and fails to do so, because the NSData object is not a valid json string.

When symbolicating the 4th line as described above in the post, you will get the exact line in your code where this happens.

Kerni
  • 15,241
  • 5
  • 36
  • 57
  • Sorry for not adding the binary image when I first posted the question, there is a 3000 characters limit on any question or answers posted here in Stackoverflow. – B.I.A Feb 24 '14 at 05:40
  • @B.I.A So why don't you drag the full crash report into the organizer to get it symbolicated by Xcode? – Kerni Feb 24 '14 at 09:11
  • I tried that what I get is a popup window showing the same crash report, I tried atos -arch armv7 -o 'taptap.app'/'taptap' 0x8c47c , I get 0x0008c47c (in taptap) + 16180, and with armv7s I get 0x0008c47c (in taptap) + 7448, and with xcrun atos -arch armv7s -o 'taptap.app'/'taptap' 0x8c47c I get ___lldb_unnamed_function2087$$taptap (in taptap) + 7448 – B.I.A Feb 24 '14 at 10:07
  • You did drag it into "Device Logs" at the top? To use `atos` you need to pass along the dSYM as I described above! The app binary is stripped by default and doesn't show the symbols. – Kerni Feb 24 '14 at 13:05