Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Are SKProductsRequestDelegate methods always called on the main thread?

In iOS 13 I've received a few crash reports that appear to be a result of performing UI work on a different thread than the main thread after receiving productsRequest(_:didReceive:) and request(_:didFailWithError:). The documentation does not state which thread these are called on but I believe it has always been the main queue. Are they being called from a different queue now?

like image 234
Jordan H Avatar asked Oct 02 '19 03:10

Jordan H


1 Answers

I confirmed with iOS 13.1.2 that they can indeed be called from a different queue: com.apple.root.default-qos (concurrent). Eek.

The solution is to dispatch that work back to the main thread via DispatchQueue.main.async.

like image 98
Jordan H Avatar answered Oct 12 '22 08:10

Jordan H