SKStoreProductViewController initialization on non main thread

北战南征 提交于 2019-12-11 18:39:54

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!