【问题标题】:Application is not working in background应用程序无法在后台运行
【发布时间】:2014-10-01 08:41:33
【问题描述】:

在我将项目从 XCode 5 和 iOS 7.1 迁移到 XCode 6 和 iOS 8.0 之前,我的应用程序在后台运行。

不幸的是,现在___repeating 方法是在后台停止重复。我想念什么?最近我在 developer.apple.com 上做了很多更改。这可能是什么原因? Apple 是否更改了后台应用程序的工作规​​则?代码和功能屏幕位于下方。

- (instancetype)init {
    self = [super init];
    if (self) {
        [NSTimer scheduledTimerWithTimeInterval:2.0 target:self selector:@selector(___repeating) userInfo:nil repeats:YES];
    }
    return self;
}

- (void)___repeating {
    DLog(@"Working!");
}

【问题讨论】:

    标签: ios objective-c xcode ios8 xcode6


    【解决方案1】:

    这不是后台处理在 iOS 上的工作方式。 See Apple's documentation on multitasking。通常,您设置任务并等待操作系统调用特定方法,这样您的应用程序就可以在调用之间休眠。您的应用甚至可以在两次调用之间完全终止,操作系统会在适当的时候重新启动它。

    【讨论】:

    • 谢谢,这是我想听的。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2014-01-10
    • 2011-09-11
    • 1970-01-01
    • 1970-01-01
    • 2012-10-31
    • 2013-04-11
    相关资源
    最近更新 更多