8

I am trying to release my new App Version with In App Purchases but Apple rejected it twice with the following issue:

Your app crashed when we:

Attempted to download one of the In-App Purchases.

This occurred when your app was used: 

- Offline
- On Wi-Fi 

They sent me two Crash Logs which gives the following issues:

The first crash log:

Exception Type:  EXC_BAD_ACCESS (SIGBUS)
Exception Subtype: EXC_ARM_SP_ALIGN at 0x000000013fd4582e
Highlighted Thread:  1

Thread 0 name:  Dispatch queue: com.apple.libdispatch-manager
Thread 0:
0   libsystem_kernel.dylib          0x0000000197071aa8 kevent64 + 8
1   libdispatch.dylib               0x0000000196f75998 _dispatch_mgr_thread + 48

Thread 1 name:  com.apple.NSURLConnectionLoader
Thread 1:
0   libsystem_kernel.dylib          0x0000000197071ca0 mach_msg_trap + 8
1   CoreFoundation                  0x0000000189f7eb70 __CFRunLoopServiceMachPort + 180
2   CoreFoundation                  0x0000000189f7cd00 __CFRunLoopRun + 832
3   CoreFoundation                  0x0000000189ebdc1c CFRunLoopRunSpecific + 448
4   Foundation                      0x000000018aab2424 +[NSURLConnection(Loader) _resourceLoadLoop:] + 344
5   Foundation                      0x000000018ab40408 __NSThread__main__ + 996
6   libsystem_pthread.dylib         0x000000019710be18 _pthread_body + 164
7   libsystem_pthread.dylib         0x000000019710bd70 _pthread_start + 136
8   libsystem_pthread.dylib         0x0000000197109550 thread_start + 0

Thread 2 name:  com.apple.CFSocket.private
Thread 2:
0   libsystem_kernel.dylib          0x000000019708a76c __select + 8
1   libsystem_pthread.dylib         0x000000019710be18 _pthread_body + 164
2   libsystem_pthread.dylib         0x000000019710bd70 _pthread_start + 136
3   libsystem_pthread.dylib         0x0000000197109550 thread_start + 0

Thread 3:
0   libsystem_kernel.dylib          0x0000000197071ca0 mach_msg_trap + 8
1   CoreFoundation                  0x0000000189f7eb70 __CFRunLoopServiceMachPort + 180
2   CoreFoundation                  0x0000000189f7cd00 __CFRunLoopRun + 832
3   CoreFoundation                  0x0000000189ebdc1c CFRunLoopRunSpecific + 448
4   CoreFoundation                  0x0000000189f132a4 CFRunLoopRun + 108
5   CoreMotion                      0x000000018a676538 0x18a638000 + 255288
6   libsystem_pthread.dylib         0x000000019710be18 _pthread_body + 164
7   libsystem_pthread.dylib         0x000000019710bd70 _pthread_start + 136
8   libsystem_pthread.dylib         0x0000000197109550 thread_start + 0

Thread 4:
0   libsystem_kernel.dylib          0x000000019708ae74 __workq_kernreturn + 8
1   libsystem_pthread.dylib         0x0000000197109548 start_wqthread + 0

Thread 5:
0   libsystem_kernel.dylib          0x000000019708ae74 __workq_kernreturn + 8
1   libsystem_pthread.dylib         0x0000000197109548 start_wqthread + 0

Thread 6:
0   libsystem_kernel.dylib          0x000000019708ae74 __workq_kernreturn + 8
1   libsystem_pthread.dylib         0x0000000197109548 start_wqthread + 0

Thread 7:
0   libsystem_kernel.dylib          0x000000019708ae74 __workq_kernreturn + 8
1   libsystem_pthread.dylib         0x0000000197109548 start_wqthread + 0

and the second one:

Exception Type:  EXC_BAD_ACCESS (SIGSEGV)
Exception Subtype: KERN_INVALID_ADDRESS at 0x000000013fefffb0
Highlighted Thread:  1

Thread 0 name:  Dispatch queue: com.apple.libdispatch-manager
Thread 0:
0   libsystem_kernel.dylib          0x0000000197071aa8 kevent64 + 8
1   libdispatch.dylib               0x0000000196f75998 _dispatch_mgr_thread + 48

Thread 1 name:  com.apple.NSURLConnectionLoader
Thread 1:
0   libsystem_kernel.dylib          0x0000000197071ca0 mach_msg_trap + 8
1   CoreFoundation                  0x0000000189f7eb70 __CFRunLoopServiceMachPort + 180
2   CoreFoundation                  0x0000000189f7cd00 __CFRunLoopRun + 832
3   CoreFoundation                  0x0000000189ebdc1c CFRunLoopRunSpecific + 448
4   Foundation                      0x000000018aab2424 +[NSURLConnection(Loader) _resourceLoadLoop:] + 344
5   Foundation                      0x000000018ab40408 __NSThread__main__ + 996
6   libsystem_pthread.dylib         0x000000019710be18 _pthread_body + 164
7   libsystem_pthread.dylib         0x000000019710bd70 _pthread_start + 136
8   libsystem_pthread.dylib         0x0000000197109550 thread_start + 0

Thread 2 name:  com.apple.CFSocket.private
Thread 2:
0   libsystem_kernel.dylib          0x000000019708a76c __select + 8
1   libsystem_pthread.dylib         0x000000019710be18 _pthread_body + 164
2   libsystem_pthread.dylib         0x000000019710bd70 _pthread_start + 136
3   libsystem_pthread.dylib         0x0000000197109550 thread_start + 0

Thread 3 name:  WebThread
Thread 3:
0   libsystem_kernel.dylib          0x0000000197071ca0 mach_msg_trap + 8
1   CoreFoundation                  0x0000000189f7eb70 __CFRunLoopServiceMachPort + 180
2   CoreFoundation                  0x0000000189f7cd00 __CFRunLoopRun + 832
3   CoreFoundation                  0x0000000189ebdc1c CFRunLoopRunSpecific + 448
4   WebCore                         0x0000000193aabfd8 RunWebThread(void*) + 468
5   libsystem_pthread.dylib         0x000000019710be18 _pthread_body + 164
6   libsystem_pthread.dylib         0x000000019710bd70 _pthread_start + 136
7   libsystem_pthread.dylib         0x0000000197109550 thread_start + 0

Thread 4 name:  JavaScriptCore::BlockFree
Thread 4:
0   libsystem_kernel.dylib          0x000000019708a394 __psynch_cvwait + 8
1   JavaScriptCore                  0x000000018b1a6858 JSC::BlockAllocator::blockFreeingThreadMain() + 248
2   JavaScriptCore                  0x000000018b1a2330 WTF::wtfThreadEntryPoint(void*) + 20
3   libsystem_pthread.dylib         0x000000019710be18 _pthread_body + 164
4   libsystem_pthread.dylib         0x000000019710bd70 _pthread_start + 136
5   libsystem_pthread.dylib         0x0000000197109550 thread_start + 0

Thread 5 name:  JavaScriptCore::Marking
Thread 5:
0   libsystem_kernel.dylib          0x000000019708a394 __psynch_cvwait + 8
1   JavaScriptCore                  0x000000018b3ce514 JSC::GCThread::waitForNextPhase() + 104
2   JavaScriptCore                  0x000000018b3ce5a8 JSC::GCThread::gcThreadMain() + 88
3   JavaScriptCore                  0x000000018b1a2330 WTF::wtfThreadEntryPoint(void*) + 20
4   libsystem_pthread.dylib         0x000000019710be18 _pthread_body + 164
5   libsystem_pthread.dylib         0x000000019710bd70 _pthread_start + 136
6   libsystem_pthread.dylib         0x0000000197109550 thread_start + 0

Thread 6:
0   libsystem_kernel.dylib          0x000000019708ae74 __workq_kernreturn + 8
1   libsystem_pthread.dylib         0x0000000197109548 start_wqthread + 0

Thread 7:
0   libsystem_kernel.dylib          0x0000000197071ca0 mach_msg_trap + 8
1   CoreFoundation                  0x0000000189f7eb70 __CFRunLoopServiceMachPort + 180
2   CoreFoundation                  0x0000000189f7cd00 __CFRunLoopRun + 832
3   CoreFoundation                  0x0000000189ebdc1c CFRunLoopRunSpecific + 448
4   libAVFAudio.dylib               0x0000000188d5d5ec GenericRunLoopThread::Entry(void*) + 156
5   libAVFAudio.dylib               0x0000000188d5201c CAPThread::Entry(CAPThread*) + 100
6   libsystem_pthread.dylib         0x000000019710be18 _pthread_body + 164
7   libsystem_pthread.dylib         0x000000019710bd70 _pthread_start + 136
8   libsystem_pthread.dylib         0x0000000197109550 thread_start + 0

Thread 8:
0   libsystem_kernel.dylib          0x0000000197071ca0 mach_msg_trap + 8
1   CoreFoundation                  0x0000000189f7eb70 __CFRunLoopServiceMachPort + 180
2   CoreFoundation                  0x0000000189f7cd00 __CFRunLoopRun + 832
3   CoreFoundation                  0x0000000189ebdc1c CFRunLoopRunSpecific + 448
4   CoreFoundation                  0x0000000189f132a4 CFRunLoopRun + 108
5   CoreMotion                      0x000000018a676538 0x18a638000 + 255288
6   libsystem_pthread.dylib         0x000000019710be18 _pthread_body + 164
7   libsystem_pthread.dylib         0x000000019710bd70 _pthread_start + 136
8   libsystem_pthread.dylib         0x0000000197109550 thread_start + 0

Thread 9:
0   libsystem_kernel.dylib          0x000000019708ae74 __workq_kernreturn + 8
1   libsystem_pthread.dylib         0x0000000197109548 start_wqthread + 0

My app works fine in three devices i have tested it (iPhone 4, iPhone5, and iPad), it doesn't crash and i can purchase In Apps without any problem. My app responds to network reachability, so i have tested it when device is in offline mode, Wi-Fi only and when reachability changes while user is purchasing the InApp's. I have read and tried to analyze these crash logs, i have also checked for memory leaks with Allocations and Leaks and for low memory warnings with Zombies in Xcode Instruments but i can't seem to find anything wrong with my code.

Can you please give me a little help about what should i do and where should i look more carefully?

  • Did you check the internet connection availability when any user try to do the In-App purchase, Like Reachability class do or Networking Class? – mAc Jul 08 '14 at 12:55
  • 1
    @mAc Yes i have a Network Reachability class that checks if the device is connected to the internet to make the purchases and if not i show an UIAlertView. – Aleksander Prenga Jul 08 '14 at 13:03
  • 1
    Symbolicate the crash reports ? – CW0007007 Jul 08 '14 at 13:09
  • Try to request DSYM files for this issue from Apple Approve Team. – Sergei Nikitin Jul 08 '14 at 13:20
  • 1
    Guys, the crash report is already symbolicated! And there is no dSYM you could request from Apple, since that only exists on the machine that created the build. And since it is already symbolicated, the dSYM was available. – Kerni Jul 08 '14 at 15:44
  • 4
    You must be using threads for your app In-App Purchases !!!, If yes, just look for any problem in that. One more doubt, Apple said your app crashed when they check OFFLINE, that means your UIAlertView doesn't get called else app won't be crashed. Check your app on slow connection as well as no connection too again. – mAc Jul 09 '14 at 04:51
  • You didn't mention if you've tested the app offline and over wifi only. Have you tried every permutation, canceling a purchase, restoring, etc. with each network mode they mention? I have found that they fail every submission that has any problem with IAPs so you need to completely test them each time you submit and cannot assume minor changes will pass. With that said, those logs look like network failures and the issues are for offline and wifi. There must be a hole in the logic that guards against network access during IAP process. I'd turn off the network and step through the code. – Fran K. Jul 09 '14 at 22:40
  • @Kerni is right, i have symbolicated the crash log as you see. – Aleksander Prenga Jul 10 '14 at 07:20
  • @mAc I was using threads but i just released another version where i worked without threads and i have tested my app when device is on Wi-Fi only and offline mode and so i am sure it shows a popUp alert. I have also tested my app when network reachability changes while user is buying the InApp. – Aleksander Prenga Jul 10 '14 at 07:23
  • @FranK. It seems logic to me what you say, maybe i have something wrong when my reachability changes in some specific case. I'll check my code one more time. I will try also mAc's suggestion about slow connection although i have tried to fill all my holes of network in my code :( – Aleksander Prenga Jul 10 '14 at 07:34
  • I know it feels sad when nothing suggestion works, just take a deep breath and test once again the app with all possible combinations of network.Apple said app crashed Offline... try turning the connection off at different positions of the app. Your crash report mention NSUrlConnectionLoader error, means somewhere your fetched or created url creating problem, debug all NSUrl's in your app. Good luck – mAc Jul 10 '14 at 08:17
  • Which kind of purchase? Is there hosted content with Apple? Do you have hosted *and* not hosted content? Assuming you are using ARC, correct? Is it at all possible you are responding to `SKPaymentTransactionObserver` notifications *or any other notifications* **assuming** they are initiated on the main thread, and not wrapping UI changes in `dispatch_async` blocks? This includes StoreKit & Reachability. It could explain why you can't reproduce the crash with ease. – SwiftArchitect Jul 10 '14 at 14:22
  • @LancelotdelaMare Back then my problem was not at implementing In-App Purchases, the problem were that when I was getting the list of the In-Apps I sorted them by name, but i sorted only the names and not the whole Array of Models. The problem with me was that when user attempted to download an In-App another one was called (the bad sorting problem). Apple Review Team just told me several times that the app crashed, but my app didn't crash, this was the problem and after I fixed it this everything was cool and the app were accepted. – Aleksander Prenga Jul 23 '15 at 13:05
  • You may want to answer your own question with your findings: mismatched In-App Purchase IDs. Thanks for the update. Leave no question unanswered! – SwiftArchitect Jul 23 '15 at 18:54

1 Answers1

0

Have you tried to test with a newly created sandbox account?

Anand
  • 864
  • 10
  • 31