开发者

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜