有人可以确认我认为由于SKProductsRequestDelegate
仍然被分配而生成以下崩溃报告,但代码本身不是吗?即VC已关闭?
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
如果我的想法是正确的,我可以通过致电: -
来解决这个问题request.delegate = nil;
[request cancel];
request = nil;
如果我不正确,有人可以为我提供更多关于此的内容吗?
感谢。
答案 0 :(得分:24)
对于ref,我添加以下代码确实纠正了这个问题。
request.delegate = nil;
[request cancel];
request = nil;