从didReceiveRemoteNotification解析警告:fetchCompletionHandler [英] Parse warning from didReceiveRemoteNotification:fetchCompletionHandler

查看:671
本文介绍了从didReceiveRemoteNotification解析警告:fetchCompletionHandler的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

从parse.com添加此代码后出现错误:

I am getting an error after adding this code from parse.com:

- (void)application:(UIApplication *)application
didReceiveRemoteNotification:(NSDictionary *)userInfo
fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler {
    if (application.applicationState == UIApplicationStateInactive) {
        [PFAnalytics trackAppOpenedWithRemoteNotificationPayload:userInfo];
    }
}

我真的不明白发生了什么,但是我在日志中收到了这个警告:

I don't really understand what is going on, but I am getting this warning in the log:


你已经实现了 - [
应用程序:didReceiveRemoteNotification:fetchCompletionHandler:],但是
你还需要在你的Info.plist中的
支持的UIBackgroundModes列表中添加remote-notification。

You've implemented -[ application:didReceiveRemoteNotification:fetchCompletionHandler:], but you still need to add "remote-notification" to the list of your supported UIBackgroundModes in your Info.plist.

我认为在plist文件中添加 UIBackgroundModes - remote-notification 可以解决问题,

I think adding in your plist file UIBackgroundModes - remote-notification would fix the problem,

但是,当我这样做时,它将单词更改为以下内容:

But when I do that, it changes the words to the follow:

所需的背景模式 - > 应用程序下载内容以响应推送通知

我的应用程序没有这样做,所以我很困惑为什么我是首先执行此操作。

Which my app doesn't do, so I am confused as to why I am doing this in the first place.

推荐答案

如果您不打算获取数据以响应远程通知我认为哟你可以实现这个委托方法:

If you don't intend to fetch data in response to a remote notification I think you can implement this delegate method:

- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo 

例如

- (void)application:(UIApplication *)application
didReceiveRemoteNotification:(NSDictionary *)userInfo {
    if (application.applicationState == UIApplicationStateInactive) {
        [PFAnalytics trackAppOpenedWithRemoteNotificationPayload:userInfo];
    }
}

而不是您当前正在使用的当前。

instead of the current one you're using.

这篇关于从didReceiveRemoteNotification解析警告:fetchCompletionHandler的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆