gpt4 book ai didi

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

转载 作者:塔克拉玛干 更新时间:2023-11-02 08:17:46 24 4
gpt4 key购买 nike

我将 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为什么?

最佳答案

您是否使用 AdHoc ipa 构建测试生产推送?

如果你用 Debug模式测试它——它不会工作

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

我已经写了一个答案如何让它工作

关于ios - quickblox 推送通知在生产模式下不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25228179/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com