ios - SKProduct 崩溃 - 仅在商店版本的应用程序中

标签 ios swift crash skproduct

我有一个带有以下 SKProduct 代码的 swift 应用

func validateProductIdentifiers() {

        let identifiers:NSSet = NSSet(array: kProductIdentifiers)
        let productRequest = SKProductsRequest(productIdentifiers: identifiers)
        productRequest.delegate = self
        productRequest.start()
    }

    func productsRequest(request: SKProductsRequest!, didReceiveResponse response: SKProductsResponse!) {

        let product:SKProduct = response.products[0] as SKProduct

        homeView!.stopActivityAnimating()
        loadBulletBuy()
        bulletBuy!.loadBuyData(response)


    }

我已经在我的设备上测试这个应用程序将近一个月了,并且在调用此方法期间应用程序从未失败/崩溃。

现在我的应用上线了,我发现我的应用在上述方法中崩溃了。我设备的崩溃日志

Thread 0 name:  Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0   FrontLine                       0x000000010016654c @objc FrontLine.GameViewController.productsRequest (FrontLine.GameViewController)(ObjectiveC.SKProductsRequest!, didReceiveResponse : ObjectiveC.SKProductsResponse!) -> () (GameViewController.swift:0)
1   StoreKit                        0x0000000186638dac __34-[SKProductsRequest _handleReply:]_block_invoke + 540
2   libdispatch.dylib               0x0000000192cb53a8 _dispatch_call_block_and_release + 20
3   libdispatch.dylib               0x0000000192cb5368 _dispatch_client_callout + 12
4   libdispatch.dylib               0x0000000192cb997c _dispatch_main_queue_callback_4CF + 928
5   CoreFoundation                  0x0000000181eddfa0 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 8
6   CoreFoundation                  0x0000000181edc048 __CFRunLoopRun + 1488
7   CoreFoundation                  0x0000000181e090a0 CFRunLoopRunSpecific + 392
8   GraphicsServices                0x000000018afa35a0 GSEventRunModal + 164
9   UIKit                           0x000000018673aaa0 UIApplicationMain + 1484
10  FrontLine                       0x0000000100189640 main (AppDelegate.swift:0)
11  libdyld.dylib                   0x0000000192cdea04 start + 0

我做了一些搜索,发现这可能是由于委托(delegate)的解除分配,在我的例子中是 VC。我现在正在尝试一种新的解决方案。

但我无法理解为什么该应用程序在我的测试运行中从未崩溃,而在生产环境中单独崩溃。

我尝试安装我的开发版应用程序,应用程序运行流畅,就像我安装应用程序商店版本时崩溃一样。

关于如何防止此类故障的任何见解都会有所帮助

谢谢

最佳答案

问题在投入生产大约 3 小时后消失。看起来某些支付流程滞后于实际应用发布。

关于ios - SKProduct 崩溃 - 仅在商店版本的应用程序中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28506766/

相关文章:

ios - 同时弹起 UIVCollectionView 和重新加载部分时的动画问题

ios - 当该页面出现时,如何在 UISearchController 中自动启用搜索栏?

ios - hpple无法解析HTML

iphone - appdelegate 中的 clickedButtonAtIndex 未被调用

ios - 将 SSL https 与 socket.io 和 swift 一起用于 iOS 应用程序

ios - 当文本与文本字段大小相同时,如何停止在文本字段中输入字符?

browser - 网站完全崩溃ie7?

c# - 在使用 .NET 4.0 的 x64 位机器上加载资源的静默失败背后的原因是什么?

c - 追加节点后双链表崩溃

ios - 如何: Debug UIWindows were created prior to initial application activation