applicationDidBecomeActive

applicationDidBecomeActive

我想知道如何为用户提供从服务器下载内容的方法。

如果用户订阅一个月,我想每天为他们提供新的内容(歌曲)。但是我不确定该如何处理。

我是否需要使用application didFinishLaunchingWithOptions或-(void)applicationDidBecomeActive:(UIApplication *)application {调用网络服务

在这种情况下我应该使用哪一个?

最佳答案

如果您打算在应用启动时开始建立新连接,那么您将需要使用

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    // Override point for customization after application launch.
    return YES;
}

但是,applicationDidBecomeActive更适合恢复在后台运行应用程序时暂停的下载。也可以从此处开始下载。
- (void)applicationDidBecomeActive:(UIApplication *)application
{
    // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}

关于iphone - 应用程序didFinishLaunchingWithOptions或applicationDidBecomeActive,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/12088958/

10-10 20:42