【问题标题】:Sinch, message shouldSendPushNotification not being calledSinch,未调用消息 shouldSendPushNotification
【发布时间】:2014-06-02 15:25:27
【问题描述】:

我正在尝试在 Sinch 中实现推送功能。

我已经这样设置了我的客户:

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

_client.delegate = self;

[_client start];
[_client startListeningOnActiveConnection];

然后

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

在 AppDelegate.h 中

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

其他委托方法工作正常(messageSent、messageDelivered 等),但是,我似乎无法调用

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

为了测试,我设置了两部手机,每部手机都运行一个 SinchClient,并强制退出其中一部手机上的应用程序(假设应该触发离线状态)——但仍然没有骰子。我正在查看断点,但委托似乎没有触发。

有什么想法吗?

谢谢, 查理

【问题讨论】:

    标签: sinch


    【解决方案1】:

    确保两部手机都注册了推送数据(例如,无法在模拟器上运行)。否则,将其中一台设备置于飞行模式并尝试向该设备发送消息就足以获得shouldSendPushNotification 回调(确保您在两台设备上以不同用户身份登录)。 如果您没有收到messageSent 回调,您将不会收到shouldSendPushNotification 回调。同样,如果您收到messageDelivered 事件,您将不会收到shouldSendPushNotification

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-04-25
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多