解析来自 didReceiveRemoteNotification:fetchCompletionHandler 的警告 [英] Parse warning from didReceiveRemoteNotification:fetchCompletionHandler

查看:22
本文介绍了解析来自 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:

您已经实施了 -[application:didReceiveRemoteNotification:fetchCompletionHandler:],但是您仍然需要将远程通知"添加到您的列表中Info.plist 中支持的 UIBackgroundModes.

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天全站免登陆