我有一个具有本地数据库的应用程序,我希望在从后台调用该应用程序时调用一个函数(即当我从“任务管理器”中调用它时),以便我可以从网络服务更新我的数据库.调用的方法是什么?我可以让它在我的应用程序的委托(delegate)中执行吗?
最佳答案
检查 UIApplicationDelegate 中的 applicationWillEnterForeground:
和 applicationDidBecomeActive
方法。
applicationWillEnterForeground
In iOS 4.0 and later, this method is called as part of the transition from the background to the active state. You can use this method to undo many of the changes you made to your application upon entering the background. The call to this method is invariably followed by a call to the
applicationDidBecomeActive:
method, which then moves the application from the inactive to the active state.
关于iphone - 当应用程序从后台重新启动时,我的 AppDelegate.m 中的什么方法被执行?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7496135/