0

我正在测试 QuickBlox 中的 APNS 消息功能。我使用示例代码并使用单用户选项创建用户(“pushuser”)和密码,并按照 QuickBlox 说明的指示在 appdelegate.m 中的代码中添加身份验证标准(请参阅包含的代码)。该应用程序编译良好,当第一次加载到我的 iPhone 上时,我得到了关于允许应用程序推送通知的弹出窗口。我检查了通知区域中的 iPhone 设置,并看到该应用程序在其中并允许发送通知。当我转到 QuickBlox 管理面板并尝试发送测试简单推送通知时。我在管理面板顶部收到错误消息“没有收件人。至少应为一名用户订阅 APNS(Apple Push)(通过 SDK 或 REST API)”。我的 QuikBlox 应用程序 ID,AuthorizationKey 和 AuthorizationSecret 都正确包含,因为我可以使用需要这些的应用程序做其他事情。任何帮助表示赞赏。谢谢!

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

    // Set QuickBlox credentials (You must create application in admin.quickblox.com)
    [QBSettings setApplicationID:xxxx];
    [QBSettings setAuthorizationKey:@"xxxxxx"];
    [QBSettings setAuthorizationSecret:@"xxxxxx"];



    [QBAuth createSessionWithDelegate:self];

    self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]  autorelease];

    // Show Splash
    self.splashController = [[[SplashController alloc]    initWithNibName:@"SplashViewController" bundle:nil] autorelease];
    self.window.rootViewController = (UIViewController*)self.splashController;
    [self.window makeKeyAndVisible];

    return YES;

    QBASessionCreationRequest *extendedAuthRequest =[QBASessionCreationRequest request];
    extendedAuthRequest.userLogin = @"pushuser";
    extendedAuthRequest.userPassword = @"pushuserpwd";

    [QBAuth createSessionWithExtendedRequest:extendedAuthRequest delegate:self];
}
#pragma mark -
#pragma mark QBActionStatusDelegate

    // QuickBlox queries delegate
    - (void)completedWithResult:(Result *)result{

        if(result.success) {
            // Create session result
            if([result isKindOfClass:QBAAuthSessionCreationResult.class]){
                // You have successfully created the session

                // Subscribe Users to Push Notifications
                [QBMessages TRegisterSubscriptionWithDelegate:self];

                // Subscribe User to Push Notifications result
            }else if([result isKindOfClass:QBMRegisterSubscriptionTaskResult.class]){
                // Now you can receive Push Notifications!
            }

        }else{
            NSLog(@"errors=%@", result.errors);
        }
    }
4

1 回答 1

0

我会要求您尝试的一件事是检查日志

有什么错误吗?

NSLog(@"errors=%@", result.errors);

因为这个查询 [QBMessages TRegisterSubscriptionWithDelegate:self]; 可能会返回错误,并且您订阅推送通知不会成功。例如,您使用无效的配置文件可能会失败。

谢谢

于 2013-05-02T08:03:46.533 回答