简体   繁体   中英

iOS push notifications - does application:didRegisterForRemoteNotificationsWithDeviceToken: execute in main thread?

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 put 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM