iosswiftcrashskproduct

SKProduct crash - only in store version of app


I have a swift app with below SKProduct code

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)


    }

I have been testing this app is my device for close to a month and the app never failed/crashed during a call to this method.

Now my app is live and I found my app is crashing in above method. Crash log from my device

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

I did some searching and found that it may be due to deallocation of delegate and in my case a VC. I am trying out a new solution now.

But I am not able to understand why the app never crashed in my test runs and crashing in production alone.

I tried to install my dev version of app and the app runs smooth where as if I install the app store version it crashes.

Any insight on how I can prevent such failures would be helpful

Thanks


Solution

  • The issue disappeared after like 3 hours in production.Looks like some payment process lags behind actual app release.