iOS In App Purchase crashed only in App review - works find in sandbox testing

I have a new app which has been rejected twice with the same crash logs. They say it crashes when they tap the Buy button for in app purchase and gave me the crash file. I have symbolicated it and it hasn't been much helpful to me, can someone else take a look and point out if something's wrong?

The IAP has been tested successfully in sandbox with 2 sandbox users. I have also made sure my IAP has been actually "Cleared for sale" from my side and also "Submitted for review". My bank account info is up to date too and contracts are approved.

Here's the symbolicated logs:

{"app_name":"APPNAME","timestamp":"2017-12-18 08:48:19.56 -0800","app_version":"1.0","slice_uuid":"915a18a0-7c26-3ffd-af45-102cc6d53e21","adam_id":1326580740,"build_version":"2","bundleID":"com.MYCOMPANY.APPNAME","share_with_app_devs":false,"is_first_party":false,"bug_type":"109","os_version":"iPhone OS 11.2.1 (15C153)","incident_id":"43C16882-BFF8-4C5E-80D7-01AEEE78F017","name":"APPNAME"}
Incident Identifier: 43C16882-BFF8-4C5E-80D7-01AEEE78F017
CrashReporter Key:   6079b68e9b231d52a24bc0ce1c55aa975b16774c
Hardware Model:      xxx
Process:             APPNAME [1217]
Path:                /private/var/containers/Bundle/Application/81E108AB-4E43-4034-9A37-6C83929E75D4/APPNAME.app/APPNAME
Identifier:          com.MYCOMPANY.APPNAME
Version:             2 (1.0)
Code Type:           ARM-64 (Native)
Role:                Foreground
Parent Process:      launchd [1]
Coalition:           com.MYCOMPANY.APPNAME [832]


Date/Time:           2017-12-18 08:48:19.4110 -0800
Launch Time:         2017-12-18 08:43:02.9432 -0800
OS Version:          iPhone OS 11.2.1 (15C153)
Baseband Version:    6.30.04
Report Version:      104

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

Application Specific Information:
abort() called

Filtered syslog:
None found

Last Exception Backtrace:
0   CoreFoundation                  0x18411e364 __exceptionPreprocess + 124
1   libobjc.A.dylib                 0x183364528 objc_exception_throw + 55
2   CoreFoundation                  0x18411e2ac +[NSException raise:format:] + 115
3   StoreKit                        0x19758aa98 -[SKPaymentQueue addPayment:] + 539
4   APPNAME                     0x1007a362c 0x100798000 + 46636
5   UIKit                           0x18d6346b4 -[UIApplication sendAction:to:from:forEvent:] + 95
6   UIKit                           0x18d634634 -[UIControl sendAction:to:forEvent:] + 79
7   UIKit                           0x18d61f1dc -[UIControl _sendActionsForEvents:withEvent:] + 439
8   UIKit                           0x18d633f28 -[UIControl touchesEnded:withEvent:] + 575
9   UIKit                           0x18d633a48 -[UIWindow _sendTouchesForEvent:] + 2543
10  UIKit                           0x18d62ef60 -[UIWindow sendEvent:] + 3207
11  UIKit                           0x18d5fff64 -[UIApplication sendEvent:] + 339
12  UIKit                           0x18df5531c __dispatchPreprocessedEventFromEventQueue + 2363
13  UIKit                           0x18df578a8 __handleEventQueueInternal + 4759
14  UIKit                           0x18df507c0 __handleHIDEventFetcherDrain + 151
15  CoreFoundation                  0x1840c697c __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 23
16  CoreFoundation                  0x1840c68fc __CFRunLoopDoSource0 + 87
17  CoreFoundation                  0x1840c6184 __CFRunLoopDoSources0 + 203
18  CoreFoundation                  0x1840c3d5c __CFRunLoopRun + 1047
19  CoreFoundation                  0x183fe3e58 CFRunLoopRunSpecific + 435
20  GraphicsServices                0x185e90f84 GSEventRunModal + 99
21  UIKit                           0x18d66367c UIApplicationMain + 235
22  APPNAME                     0x1007aab60 0x100798000 + 76640
23  libdyld.dylib                   0x183b0056c start + 3


Thread 0 name:  Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0   libsystem_kernel.dylib          0x0000000183c302e8 __pthread_kill + 8
1   libsystem_pthread.dylib         0x0000000183d452f8 pthread_kill$VARIANT$mp + 396
2   libsystem_c.dylib               0x0000000183b9efbc abort + 140
3   libc++abi.dylib                 0x000000018333b068 __cxa_bad_cast + 0
4   libc++abi.dylib                 0x000000018333b210 default_unexpected_handler+ 8720 () + 0
5   libobjc.A.dylib                 0x0000000183364810 _objc_terminate+ 34832 () + 124
6   libc++abi.dylib                 0x000000018335354c std::__terminate(void (*)+ 107852 ()) + 16
7   libc++abi.dylib                 0x0000000183353158 __cxa_rethrow + 144
8   libobjc.A.dylib                 0x00000001833646e8 objc_exception_rethrow + 44
9   CoreFoundation                  0x0000000183fe3ec4 CFRunLoopRunSpecific + 544
10  GraphicsServices                0x0000000185e90f84 GSEventRunModal + 100
11  UIKit                           0x000000018d66367c UIApplicationMain + 236
12  APPNAME                     0x00000001007aab60 0x100798000 + 76640
13  libdyld.dylib                   0x0000000183b0056c start + 4

Thread 1 name:  com.apple.uikit.eventfetch-thread
Thread 1:
0   libsystem_kernel.dylib          0x0000000183c0f568 mach_msg_trap + 8
1   libsystem_kernel.dylib          0x0000000183c0f3e0 mach_msg + 72
2   CoreFoundation                  0x00000001840c6308 __CFRunLoopServiceMachPort + 196
3   CoreFoundation                  0x00000001840c3ed4 __CFRunLoopRun + 1424
4   CoreFoundation                  0x0000000183fe3e58 CFRunLoopRunSpecific + 436
5   Foundation                      0x0000000184a19594 -[NSRunLoop+ 50580 (NSRunLoop) runMode:beforeDate:] + 304
6   Foundation                      0x0000000184a389ac -[NSRunLoop+ 178604 (NSRunLoop) runUntilDate:] + 96
7   UIKit                           0x000000018e1cd7b8 -[UIEventFetcher threadMain] + 136
8   Foundation                      0x0000000184b1b0f4 __NSThread__start__ + 996
9   libsystem_pthread.dylib         0x0000000183d442b4 _pthread_body + 308
10  libsystem_pthread.dylib         0x0000000183d44180 _pthread_body + 0
11  libsystem_pthread.dylib         0x0000000183d42b74 thread_start + 4

Thread 2 name:  com.apple.NSURLConnectionLoader
Thread 2:
0   libsystem_kernel.dylib          0x0000000183c0f568 mach_msg_trap + 8
1   libsystem_kernel.dylib          0x0000000183c0f3e0 mach_msg + 72
2   CoreFoundation                  0x00000001840c6308 __CFRunLoopServiceMachPort + 196
3   CoreFoundation                  0x00000001840c3ed4 __CFRunLoopRun + 1424
4   CoreFoundation                  0x0000000183fe3e58 CFRunLoopRunSpecific + 436
5   CFNetwork                       0x00000001848d3128 -[__CoreSchedulingSetRunnable runForever] + 780
6   Foundation                      0x0000000184b1b0f4 __NSThread__start__ + 996
7   libsystem_pthread.dylib         0x0000000183d442b4 _pthread_body + 308
8   libsystem_pthread.dylib         0x0000000183d44180 _pthread_body + 0
9   libsystem_pthread.dylib         0x0000000183d42b74 thread_start + 4

Thread 3:
0   libsystem_pthread.dylib         0x0000000183d42b68 start_wqthread + 0

Thread 4:
0   libsystem_pthread.dylib         0x0000000183d42b68 start_wqthread + 0

Thread 5:
0   libsystem_pthread.dylib         0x0000000183d42b68 start_wqthread + 0

Thread 0 crashed with ARM Thread State (64-bit):
    x0: 0x0000000000000000   x1: 0x0000000000000000   x2: 0x0000000000000000   x3: 0x00000001c40f9937
    x4: 0x0000000183358afd   x5: 0x000000016f6674d0   x6: 0x000000000000006e   x7: 0xffffffffffffffec
    x8: 0x0000000008000000   x9: 0x0000000004000000  x10: 0x0000000183d495e0  x11: 0x0000000000000003
   x12: 0xffffffffffffffff  x13: 0x0000000000000001  x14: 0x0000000183bb553f  x15: 0x0000000000000010
   x16: 0x0000000000000148  x17: 0x00000000ffffffff  x18: 0xfffffff00e09925c  x19: 0x0000000000000006
   x20: 0x00000001b4e6fb80  x21: 0x000000016f6674d0  x22: 0x0000000000000303  x23: 0x00000001b4e6fc60
   x24: 0x00000001c0005270  x25: 0x0000000000000000  x26: 0x0000000000000001  x27: 0x0000000000000000
   x28: 0x000000016f667b30   fp: 0x000000016f667430   lr: 0x0000000183d452f8
    sp: 0x000000016f667400   pc: 0x0000000183c302e8 cpsr: 0x00000000

Upvotes: 1

Views: 828

Answers (1)

I resolved this.

In Xcode > Target > Capabilities > Make sure to switch on In app purchases here. If you don't, then while testing with Sandbox, the in app purchase will work just fine. However when app review will test OR when app is live, tapping the Buy button will cause the app to crash because for some reason, the product won't load. The crash log won't be much useful as it will just show StoreKit crash but won't mention anything about capability. Enabling the IAP in capabilities is needed for the IAP to work in live apps. I have no idea why this inconsistency exists between Sandbox testing and App review/Live app.

Also in the code, only do addPayment if the Product is not nil. Since my capability wasn't set on, the product wasn't loading. So when I was calling addPayment, it crashed with:

[SKPaymentQueue addPayment:]

Also in iTunes connect, in banking info, make sure the "Account holder type" field is set. Not sure if this is a new field but mind wasn't set and I have been successfully submitting IAP for 5 years. Only this time, it said the holder type wasn't set.

Now the app review team hasn't reported IAP crash.

Upvotes: 4

Related Questions