didReceiveRemoteNotification:fetchCompletionHandler:但是从未调用完成处理程序

Mic*_*use 8 iphone ios swift

我一直在努力实现获取完成块而没有运气.每当我发送一个APN时,xcode仍然会抱怨它没有实现.这是我的代码

func application(application: UIApplication, didReceiveRemoteNotification userInfo: [NSObject : AnyObject], fetchCompletionHandler completionHandler: (UIBackgroundFetchResult) -> Void) {

    println("2. User Data", userInfo)

    completionHandler(UIBackgroundFetchResult.NewData)

}
Run Code Online (Sandbox Code Playgroud)

我在xcode控制台中收到的警告就是这个

Warning: Application delegate received call to -application:didReceiveRemoteNotification:fetchCompletionHandler: but the completion handler was never called.
Run Code Online (Sandbox Code Playgroud)

我不确定我是否在这里实现了正确的语法

Dav*_*d H 10

删除println或将其更改为NSLog,然后重试.最有可能是问题是由于此方法在后台而不是在主线程上发生的.println比NSLog简单得多,后者具有线程安全性,并且经过多年和多年的强化.