问题
I am seeing an occasional crash as I initialize SKStoreProductViewController on non main thread. I don't see any docs about initializing it on main thread. Do we have to initialize SKStoreProductViewController on main thread?
回答1:
I just made this as an answer so that it can highlight the point made by rmaddy in the comment.
Important
Use UIKit classes only from your app’s main thread or main dispatch queue, unless otherwise indicated. This restriction particularly applies to classes derived from UIResponder or that involve manipulating your app’s user interface in any way.
https://developer.apple.com/documentation/uikit
And as rmaddy pointed out, the class definition:
open class SKStoreProductViewController : UIViewController
So yes, you need to use the main thread.
来源:https://stackoverflow.com/questions/52671404/skstoreproductviewcontroller-initialization-on-non-main-thread