现在的位置: 首页 > 综合 > 正文

iOS app lifecycle some issues

2013年10月17日 ⁄ 综合 ⁄ 共 757字 ⁄ 字号 评论关闭

* 当启动app之后,是不会call applicationWillEnterForeground的,之后当app进入bg,然后返回fg时才会call it. 而applicationDidBecomeActive则是在启动app以及从bg到fg时都会trigger

* 当app在bg时,收到remote notification, 点击notification后,trigger的method的顺序为:

applicationWillEnterForeground  --> 如果有任何applicationWillEnterForeground的observer则调用相应的方法 --> didReceiveRemoteNotification 

* 像iphone mail app,在from bg to fg时就会reload  new mail。 怎么实现?这里有几个issue (我自己猜的,有可能该app是bg定期reload data的)

1. 在root view controller里add applicationWillEnterForeground observer,当bg to fg,则reload and refresh view

2. 但如果current view是sub sub view,那么当bg to fg,只会refresh root view,那么如何更新sub view? 我不觉得它在sub view里也add applicationWillEnterForeground
observer,而应该是当root view reload data complete,再通过root view dispatch a custom notification to all views, 而其他view则add observer of this custom notification view.

抱歉!评论已关闭.