Sinch, message shouldSendPushNotification not being called

一世执手 提交于 2019-12-22 13:48:25

问题


I'm trying to implement the push functionality in Sinch.

I've set up my since client as such:

[_client setSupportMessaging:YES];
[_client setSupportPushNotifications:YES];

_client.delegate = self;

[_client start];
[_client startListeningOnActiveConnection];

Then on

- (void)clientDidStart:(id<SINClient>)client {
    client.messageClient.delegate = self;
}

And in AppDelegate.h

- (void)application:(UIApplication *)application      didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
    // get previously initiated Sinch client
    id<SINClient> client = [SinchClient sharedClient].client;
    [client registerPushNotificationData:deviceToken];
}

The other delegate methods work fine (messageSent, messageDelivered, etc), however, I can't seem to invoke

(void)message:(id<SINMessage>)message shouldSendPushNotifications:(NSArray *)pushPairs

for testing, I've setup two phones each running a SinchClient, and force quit the app on the one of the phones (assuming that should trigger the offline state) - still no dice though. I'm watching a breakpoint, but the delegate doesn't seem to be firing.

Any thoughts?

Thanks, Charlie


回答1:


Make sure that both phones have registered push data (won't work on a simulator for example). Otherwise, putting one of these devices in flight mode and try to send a message to that device should suffice to get the shouldSendPushNotification callback (make sure you are signed in as different user on the two devices). If you don't receive the messageSent callback you won't receive the shouldSendPushNotification callback. Likewise, if you receive the messageDelivered event, you won't get the shouldSendPushNotification.



来源:https://stackoverflow.com/questions/23962771/sinch-message-shouldsendpushnotification-not-being-called

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!