0
当应用程序处于打开状态时,我已经成功集成了Sinch SDK并且它的工作很好,现在我正在处理应用程序处于脱机状态时的调用。iOS应用程序在使用APN离线时的Sinch调用
使用下面的方法,我可以看到推对,我将这个推对发送到服务器来推送。
- (void)call:(id<SINCall>)call shouldSendPushNotifications:(NSArray *) pushPairs {
}
在Appdelegate.m didFinishLaunchingWithOptions()方法中,我得到了sinch特定的有效负载。
NSDictionary* remotePush = [launchOptions objectForKey:UIApplicationLaunchOptionsRemoteNotificationKey];
NSLog(@"%@",remotePush);
if (remotePush) {
NSLog(@"Entery ****");
// Extract the Sinch-specific payload from the Apple Remote Push Notification
NSString* payload = [[remotePush valueForKey:@"aps"] valueForKey:@"SIN"];
// [[userInfo valueForKey:@"aps"] valueForKey:@"content-available"];
NSLog(@"Payload :%@",payload);
// Get previously initiated Sinch client
id<SINClient> client = _client;
NSLog(@"Client ID %@",[client userId]);
id<SINNotificationResult> result = [client relayRemotePushNotificationPayload:payload];
NSLog(@"Result :%@",result);
if (result.isCall && result.callResult.isTimedOut) {
// Present alert notifying about missed call
} else if (!result.isValid) {
// Handle error
}
}
下面是完整的推送通知的数据:
{
aps = {
SIN = "AgEBdeibxmJBSK2Y7Nh/fz50VMhVBVQMKzkxODg0NzE4MjQx";
alert = "";
"content-available" = 1;
type = 2;
};
}
来到这个代码:
// Get previously initiated Sinch client
id<SINClient> client = _client;
NSLog(@"Client ID %@",[client userId]);
当我打印客户端ID是零,我需要怎么去以前发起的Sinch客户端?由于App关闭,客户端实例被释放。
感谢迅速的回复,我已经按照你做,现在我可以看到用户ID,客户端启动,但呼叫不中继。当我打印ID结果= [客户端RelayRemotePushNotificationPayload:有效载荷]; NSLog(@“Result:%@”,result); 结果:。仍然呼叫不中继。 –
krish
2014-09-02 07:29:47
@krish我认为这是一个单独的问题,但请参阅http://stackoverflow.com/questions/25451427/sinch-calls-via-remote-notification-do-not-start,如果这可能是帮助 – frals 2014-09-02 08:06:48