- android - RelativeLayout 背景可绘制重叠内容
- android - 如何链接 cpufeatures lib 以获取 native android 库?
- java - OnItemClickListener 不起作用,但 OnLongItemClickListener 在自定义 ListView 中起作用
- java - Android 文件转字符串
在我的应用程序中,我有两种类型的推送通知:带有 content-available = 1
标志的远程静默通知和带有 body
、badge< 的普通推送通知
和其他东西。
我还定义了两个委托(delegate)方法 didReceiveRemoteNotification:fetchCompletionHandler
和常用的 didReceiveRemoteNotification
。
但是当没有content-available
标志的推送通知到达时,调用didReceiveRemoteNotification:fetchCompletionHandler
,而不是didReceiveRemoteNotification
。
如何解决这个问题?
为什么我不能为后台推送和常规推送设置两个委托(delegate)方法?
最佳答案
iOS 7 只调用新的,这是我在我的应用程序中处理它的方式:
-(void) application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo {
// Pass on
[self application:application didReceiveRemoteNotification:userInfo fetchCompletionHandler:nil];
}
-(void) application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler {
// Check if in background
if ([UIApplication sharedApplication].applicationState == UIApplicationStateInactive) {
// User opened the push notification
} else {
// User hasn't opened it, this was a silent update
}
}
关于ios - 为什么 didReceiveRemoteNotification :fetchCompletionHandler is called but usual didReceiveRemoteNotification isn't?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21854350/
我们的应用程序利用 didReceiveRemoteNotification: fetchCompletionHandler: 方法 UIApplicationDelegate 在收到 content
这是我完整的“AppDelegate.swift”文件: import UIKit import Parse import Bolts @UIApplicationMain class AppDele
当应用程序被强制退出时,函数 application:didReceiveRemoteNotification:fetchCompletionHandler 似乎没有被调用。我的印象是无论应用程序处于
从 parse.com 添加此代码后出现错误: - (void)application:(UIApplication *)application didReceiveRemoteNotificatio
我们已经实现了以下方法来接收远程通知,并启用了“项目能力下的后台获取和远程通知”。即使应用程序处于前台或后台,方法也会命中。但是“如果应用程序被杀死,在后台收到通知,则不会调用以下方法”。如何解决这个
我有一个应用程序,它使用远程/推送通知。 使用远程通知的后台模式,一切正常。应用程序唤醒并从服务器获取所有需要的数据。 但是如果通知中心没有清除推送通知警报,并且用户点击它 application:
在我们的应用程序中,我们想要下载少量数据以响应推送通知。到目前为止,推送通知工作顺利,在后台启动应用程序并调用 didReceiveRemoteNotification。 问题是,在此方法返回后,应用
我已经在我的应用程序中实现了远程通知,但是我遇到了 didReceiveRemoteNotification:fetchCompletionHandler: 的问题。 当手机屏幕锁定时,我会收到通知。
在我的应用程序中,我有两种类型的推送通知:带有 content-available = 1 标志的远程静默通知和带有 body、badge< 的普通推送通知 和其他东西。 我还定义了两个委托(dele
我一直在尝试实现获取完成 block ,但没有成功。每当我发送 APN 时,xcode 仍然提示它没有实现。这是我的代码 func application(application: UIApplica
我可以玩吗AVAudioPlayer当应用程序在后台使用静默推送通知时? 我目前的实现是这样的: 发送静默推送通知 didReceiveRemoteNotification:fetchCompleti
我正在尝试实现后台推送通知处理,但我无法确定用户是通过发送的推送通知打开应用程序,还是通过图标打开应用程序。 - (void)application:(UIApplication *)applicat
我有一个很奇怪的问题,我实现了: - (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDi
application: didReceiveRemoteNotification: fetchCompletionHandler: 不同于 application: didReceiveRemote
如果我覆盖 override func application(application: UIApplication, didReceiveRemoteNotification userInfo: [
我在运行 iOS 8.1 的 iPad 2 中遇到有关 APNS 的问题。我在谷歌上搜索了几天并尝试了所有我能找到的解决方案。但是我似乎无法解决这个问题。 我做了什么: 启用的功能:远程通知、后台获取
我使用 VoIP 和远程通知作为后台模式。 我让我的应用程序在后台闲置以进行通宵测试。 我在 applicationDidEnterBackground 中编写了以下代码 - (void)ap
在我们正在构建的 iPhone 应用程序中,我们使用推送通知负载中的 "content-available": 1 参数来调用 application:didReceiveRemoteNotifica
我是一名优秀的程序员,十分优秀!