未收到较大有效载荷的VOIP推送

时间:2018-12-20 08:35:43

标签: objective-c

我已经使用PushKit设置了VOIP推送通知。如果有效载荷非常小(例如仅包含标题和徽章),我就能收到推送通知。 但是,一旦我开始发送自定义有效负载,就不会收到它。

到目前为止,我看到VOIP推送的有效负载大小为5KB。我带有自定义数据的有效负载大小小于600字节。有人可以告诉我怎么了吗? 这是注册码

-(void)registerForVOIPPush {
    self.pushRegistry = [[PKPushRegistry alloc] initWithQueue:dispatch_get_main_queue()];
    self.pushRegistry.delegate = self;
    self.pushRegistry.desiredPushTypes = [NSSet setWithObjects:PKPushTypeVoIP,PKPushTypeComplication ,nil];
}

这是令牌代码:

- (void)pushRegistry:(nonnull PKPushRegistry *)registry didUpdatePushCredentials:(nonnull PKPushCredentials *)pushCredentials forType:(nonnull PKPushType)type {
    NSString *token = [[pushCredentials.token description] stringByTrimmingCharactersInSet:[NSCharacterSet characterSetWithCharactersInString:@"<>"]];
    token = [token stringByReplacingOccurrencesOfString:@" " withString:@""];
    NSLog(@"Token:%@",token);
}

以下是推送收到的代码:

-(void)pushRegistry:(PKPushRegistry *)registry didReceiveIncomingPushWithPayload:(PKPushPayload *)payload forType:(PKPushType)type {
    NSLog(@"PKPushPayload: %@",payload.dictionaryPayload);
}

以下是有效负载: {“ aps”:{“徽章”:1,“声音”:“默认”},“通知”:{“其他”:null,“来自”:null,“ notificationId”:null,“ dataObject”:{“收件人“:[” cdb89cd2-39e3-4eb7-8e36-a6634a1e410e“],”哈希“:” 95389b1f-186b-4b89-adf1-094d220c45f0“,”时间戳记“:1545294569825,” possibleDuplicate“:false,” linked“:false ,“ type”:“ TOPIC”,“ senderPhone”:“ + 918800000000”,“ fromUserId”:“ cdb89cd2-39e3-4eb7-8e36-a6634a1e410e”,“ text”:“ Ndnd”,“ chatId”:“ 5e951d10-0431 -11e9-bc35-03f4ec31e60d“,” groupId“:” 7eedd8e1-7b42-489d-9989-5fefdcd43c82“,” senderName“:”测试用户“,”状态“:” SENT“},” timeStamp“:null,”已处理“:false,” fromSync“:false,” type“:” CHAT“}}

0 个答案:

没有答案