应用程序didFinishLaunchingWithOptions`或applicationDidBecomeActive

时间:2012-08-23 09:47:06

标签: iphone ios ios4

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

我的意思是如果用户订阅了一个月,我想每天为他们提供新的内容(歌曲)。但我不确定如何解决这个问题。

我需要在application didFinishLaunchingWithOptions或 - (void)applicationDidBecomeActive:(UIApplication *)application {

中拨打网络服务吗?

请让我知道在这种情况下我应该使用哪一种。

非常感谢你的帮助

1 个答案:

答案 0 :(得分:1)

如果您计划在应用启动时启动新连接,那么您将要使用

- (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.
}