QuickBlox APNS测试问题

时间:2013-04-27 18:42:22

标签: quickblox

我正在测试QuickBlox中的APNS消息功能。我使用了示例代码并使用单用户选项创建了一个用户(“pushuser”)和密码,并按照QuickBlox指令的指示在appdelegate.m的代码中添加了身份验证标准(请参阅包含的代码)。该应用程序编译正常,当第一次加载到我的iPhone时,我得到了关于允许该应用程序的推送通知的弹出窗口。我检查通知区域中的iPhone设置,看到该应用程序在其中,并允许发送通知。当我转到QuickBlox管理面板并尝试发送测试简单推送通知时。我在管理面板顶部收到错误“没有收件人。至少应该订阅一个用户APNS(Apple推送)(通过SDK或REST API)”。我的QuikBlox ApplicationID,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);
        }
    }

1 个答案:

答案 0 :(得分:0)

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

有任何错误吗?

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

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

由于