quickblox推送通知在生产模式下不起作用

时间:2014-08-10 11:34:19

标签: ios push-notification apple-push-notifications quickblox

我在我的应用中添加了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 个答案:

答案 0 :(得分:1)

您是否使用AdHoc ipa版本测试生产推动?

如果使用调试模式进行测试 - 它将无法正常工作

阅读此主题quickblox makes the same token for development and production

我已经写了一个如何完成这项工作的答案

相关问题