问题描述
从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:
我认为在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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!