IOS 9 远程通知中的滑动按钮 - 应用程序在后台运行而不是应用程序内存不足时 [英] Swipe Buttons in IOS 9 Remote Notification - Work when app in background not when app out of memory

查看:28
本文介绍了IOS 9 远程通知中的滑动按钮 - 应用程序在后台运行而不是应用程序内存不足时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已成功通过通知为我询问的查询实现了回复 [滑动按钮无法接收远程通知

I have successfully implemented the Reply through notification for the query I asked [Swipe Buttons not coming for Remote notifications

我的问题是我确实收到了回调,我可以执行必要的操作处理,例如从文本字段中获取文本和发送聊天消息而无需使用此方法从后台运行时"打开应用程序:

My problem is that I do get a callback and I can do the necessary handling of the actions like fetching the text from text field and doing the necessary to send chat message without opening app from background 'when running' using this method:

- (void)         application:(UIApplication *)application
  handleActionWithIdentifier:(nullable NSString *)identifier
       forRemoteNotification:(NSDictionary *)userInfo
            withResponseInfo:(NSDictionary *)responseInfo
           completionHandler:(void(^)())completionHandler

我的问题是当应用程序不在内存中并且在按下主页按钮时不在后台运行时,例如通过通知的相同回复不发送聊天.

My issue is when the App is not in memory and not running in the background when home button pressed like scenario the Same Reply through notification is not sending chat.

我怀疑它无法连接 XMPP --> 连接我的数据库 --> 当应用程序完全不在后台时通过 XMPP 发送数据.

I suspect that its not able to Connect XMPP --> Connect My DB -- > Send Data over XMPP when app totally not in background.

如何处理.我想要类似于whatsapp,例如当应用程序甚至没有打开时,但在通知回复时,我们可以向其他用户发送whatsapp消息,他会收到消息,类似于Skype.

How to handle this. I want similar to whatsapp like when the app is even not switched on but on notification reply we can send a whatsapp message to other user and he gets it, similar Skype as well.

我的理解是否有缺失或必须做任何其他事情.

Am I missing in my understanding or have to do anything else.

推荐答案

对于 iPhone,应用程序需要做两件事之一:

For iPhone, the app needs to do one of two things:

  1. 使用 Apple 推送通知
  2. 请求 VOIP 权限

VOIP 将允许应用继续在后台接收消息,即使它处于睡眠"状态.但是,Apple 需要批准您的应用有资格获得此权限.

VOIP will allow the app to continue to receive messages in the background, even when it is "asleep". However, Apple needs to approve your app as qualifying for this permission.

XMPP 需要一个开放的 TCP 连接.如果连接关闭,服务器不知道如何路由消息.这意味着即使应用程序在后台,也要保持 TCP 连接打开.

XMPP requires an open TCP connection. If the connection closes, the server has no idea how to route the message. This means keeping the TCP connection open even when the app is in the background.

这种类型的安排是 Apple 归类为需要特殊许可的VOIP 功能".使用 VOIP,来电只能在具有活动 TCP 连接的电话上激活.因此,XMPP 本质上与 VOIP 相同.

This type of arrangement is what Apple classifies as a "VOIP Feature" which requires the special permission. With VOIP an incoming call can only activate on a phone with an active TCP connection. Thus, XMPP is essentially the same as VOIP.

这篇关于IOS 9 远程通知中的滑动按钮 - 应用程序在后台运行而不是应用程序内存不足时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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