我一直在努力实现获取完成块而没有运气.每当我发送一个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简单得多,后者具有线程安全性,并且经过多年和多年的强化.
| 归档时间: |
|
| 查看次数: |
8785 次 |
| 最近记录: |