开发者

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

开发者 https://www.devze.com 2023-01-30 11:22 出处:网络
I am wondering if an iOS app delegate\'sapplication:didRegisterForRemoteNotificationsWithDeviceToken: method executes in the 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 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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号