iosin-app-purchasecrash-reportsskproduct

iOS Crash Report SKProductsRequest


Could someone confirm my thinking that the following crash report would be generated due to SKProductsRequestDelegate still being allocated, yet the code itself not being? i.e. the VC has been closed?

StoreKit: __34-[SKProductsRequest _handleReply:]_block_invoke + 442

Exception Type:  EXC_BAD_ACCESS (SIGSEGV)
Exception Subtype: KERN_INVALID_ADDRESS at 0x41682340
Triggered by Thread:  0

Thread 0 Crashed:
0   libobjc.A.dylib                 0x38d19626 objc_msgSend + 6
1   StoreKit                        0x30c4784a __34-[SKProductsRequest _handleReply:]_block_invoke + 442
2   libdispatch.dylib               0x391f7830 _dispatch_call_block_and_release + 8
3   libdispatch.dylib               0x391f781c _dispatch_client_callout + 20
4   libdispatch.dylib               0x391fe49a _dispatch_main_queue_callback_4CF$VARIANT$mp + 274
5   CoreFoundation                  0x2e45f89c __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 4
6   CoreFoundation                  0x2e45e170 __CFRunLoopRun + 1296
7   CoreFoundation                  0x2e3c8eba CFRunLoopRunSpecific + 518
8   CoreFoundation                  0x2e3c8c9e CFRunLoopRunInMode + 102
9   GraphicsServices                0x3332265e GSEventRunModal + 134
10  UIKit                           0x30d15148 UIApplicationMain + 1132
11  BaseApp                         0x00035aea 0x2c000 + 39658
12  libdyld.dylib                   0x3921cab4 start + 0

If my thinking is correct, can I resolve this by calling:-

request.delegate = nil;
[request cancel];
request = nil;

If I am incorrect, could someone shed some more light on this for me?

Thanks.


Solution

  • For ref, my addition of the following code did indeed rectify the issue.

    request.delegate = nil;
    [request cancel];
    request = nil;