QuickBlox推送通知在生产模式下无法工作。

3

我在我的应用中添加了QuickBlox。

在开发模式下,推送通知系统运作良好。

然而,当我将应用置于生产模式时,后端系统显示推送已发送,但是推送未被接收。

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions{

    [QBSettings setLogLevel:QBLogLevelDebug];
    [QBSettings setApplicationID:kAppID];
    [QBSettings setAuthorizationKey:kAuthorizationKey];
    [QBSettings setAuthorizationSecret:kAuthorizationSecret];
    [QBSettings setAccountKey:@kAccountKey];

    [QBSettings useProductionEnvironmentForPushNotifications:NO];

//switch to production mode 
#ifndef DEBUG
   [QBSettings setLogLevel:QBLogLevelNothing];
   [QBSettings useProductionEnvironmentForPushNotifications:YES];
#endif


    return YES;
}

然后在我的应用程序的某个地方,我有这段代码

-(void)sendPushMessage:(QBChatAbstractMessage *)absMessage toUser:(NSInteger)userId andDelegate:(NSObject<QBActionStatusDelegate>*)delegate{
    NSString *fullName = [self fullName];
    NSString *mesage;
    if(fullName){
    mesage =[NSString stringWithFormat:@"%@ says: %@",fullName, absMessage.text];
    }else {
        mesage = absMessage.text;
    }
    NSMutableDictionary *payload = [NSMutableDictionary dictionary];
    NSMutableDictionary *aps = [NSMutableDictionary dictionary];
    [aps setObject:@"default" forKey:QBMPushMessageSoundKey];
    [aps setObject:mesage forKey:QBMPushMessageAlertKey];

    [aps setObject:[self dictionaryRepresentation] forKey:@"user_info"];
    [payload setObject:aps forKey:QBMPushMessageApsKey];

    NSLog(@"payload:%@",payload);
    QBMPushMessage *message = [[QBMPushMessage alloc] initWithPayload:payload];
    [QBMessages TSendPush:message toUsers:[@(userId) stringValue] delegate:delegate];
}

在开发环境中,这段代码运行得非常好。我检查了我的生产APNS证书好几遍,删除它,重新制作并安装它,但在生产模式下什么都没有起作用。
我尝试从管理员页面向自己发送生产推送通知,并收到了这个图像: enter image description here 而且这些用户也收到了通知: enter image description here 为什么呢?
1个回答

1

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接