I am wondering if an iOS app delegate's application:didRegisterForRemoteNotificationsWithDeviceToken:
method executes in the main thread?
Ultimately I would like to know whether it is safe to pu开发者_StackOverflow中文版t UI code in this method and if I should keep blocking code (like network interactions) out of it.
In general, are delegate methods executed in the main thread?
The application delegate methods such as:
application:didRegisterForRemoteNotificationsWithDeviceToken:
are executed on the main thread.
If you want your application to be responsive for the user you should but blocking code in a background thread.
It is safe and recommended to execute UI code on the main thread.
精彩评论