Search code examples
ios-simulatorstorekitios13

IOS13 beta 5: Does SKProductsRequest supposed to work on simulator?


Though everything works great on actual devices, I wonder why the delegate is never called back on simulator on iOS 13 beta 5?

I searched the internet for an answer, but found nothing.

I implemented the 3 functions for the protocol as follows:

public class StoreKit {
    var request: SKProductsRequest? = nil   // Keep a strong reference

    public func fetchProducts() {
        print("\(#function): start fetching products")

        let r = SKProductsRequest(productIdentifiers: productIDs)
        request = r
        r.delegate = self
        r.start()
    }

}

// MARK: - Get the requested products

extension StoreKit: SKProductsRequestDelegate {
    /// Products are received
    public func productsRequest(_ request: SKProductsRequest, didReceive response: SKProductsResponse) {
        print("\(#function): did receive")
    }



    /// Unable to received the products
    public func request(_ request: SKRequest, didFailWithError error: Error) {
        print("\(#function): Error for request: \(error.localizedDescription)")

    }



    public func requestDidFinish(_ request: SKRequest) {
        print("\(#function): did finish")
    }
}

Solution

  • The issue has been fixed by Apple in Xcode beta 6 (August 16th, 2019).

    [UPDATE Sept 30th 2019]

    For those who's still experience the issue, did you download Xcode v11.1 (11A1027), Released on September 24, 2019? I don't have any issue with it. If you still, try to add some information so that I can help you further.