Swipe Buttons in IOS 9 Remote Notification - Work

2019-07-09 13:59发布

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.

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

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.

1条回答
SAY GOODBYE
2楼-- · 2019-07-09 14:27

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

  1. Use Apple Push Notifications
  2. Request the VOIP permission

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.

EDIT:

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.

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.

查看更多
登录 后发表回答