The following code loads in the simulator on iPhone 5S, iPhone 8, iPhone X, and iPhone XS, and all iPads.
The code also loads on a physical 8 Plus device.
The code crashes in the simulator for iPhone XR, XS Max, and 8 Plus.
This error message appears in addition to the crash on those simulator sizes: "[Snapshotting] Snapshotting a view (0x615000095e00, UIView) that has not been rendered at least once requires afterScreenUpdates:YES.
"
Here is the code:
let storeViewController:SKStoreProductViewController = SKStoreProductViewController();
storeViewController.modalPresentationStyle = .pageSheet
storeViewController.delegate = self;
self.present(storeViewController, animated: true, completion: nil);
var productparameters = [String : String]()
productparameters = [SKStoreProductParameterITunesItemIdentifier:appID, SKStoreProductParameterAffiliateToken:"123abc", SKStoreProductParameterProviderToken:"123456", SKStoreProductParameterCampaignToken:campaignName];
storeViewController.loadProduct(withParameters: productparameters, completionBlock: { (success: Bool, error: Error?) -> Void in
})
I also occasionally get this error message after the crash:
Any help would be greatly appreciated! I've tried it on two different Macs and after restarting Xcode and cleaning the build folder but it consistently crashes on XR, XS Max, and Plus devices in the simulator.
Since the simulator doesn't have the App Store, StoreKit is not available on the simulator. It requires a physical device.
Of course, it shouldn't crash probably. But that sounds like a bug with Apple's code. Probably would be best to report it to them directly for that.
Running on an actual physical device should work tho!