swiftlang / swift

The Swift Programming Language
https://swift.org
Apache License 2.0
67.69k stars 10.39k forks source link

SKProductsRequest crashing on device but not when run in Xcode #60489

Open safarsafarov opened 2 years ago

safarsafarov commented 2 years ago

Describe the bug I'm having an issue when calling the following code when the device is not running via Xcode. When running via Xcode everything works perfectly fine. Really not sure what could be causing SKProductsRequest to fail when running the app away from Xcode.

Code is straight forward and inside the init() I'm using

    request = SKProductsRequest(productIdentifiers: identifiers)
    request.delegate = self
    request.start()

The delegate response:

internal func productsRequest(_ request: SKProductsRequest, didReceive response: SKProductsResponse) { products = response.products }

Things I've checked:

The identifiers are the same
The request doesn't return an error
Nothing reported in the console crash logs
App Store setup is configured correctly
App Store Connect information is correct

This only happens when the device is disconnected from an Xcode run session and works when using cmd+r. If I remove the code inside the init everything works fine, except I'm not getting the products :)

theblixguy commented 2 years ago

I don’t think this is a Swift issue, but rather a StoreKit framework issue. You can report your bug here - https://feedbackassistant.apple.com/