在从ios应用程序注册QuickBlox中的新用户时终止应用程序 [英] Terminating app while signing up a new user in QuickBlox from ios application

查看:252
本文介绍了在从ios应用程序注册QuickBlox中的新用户时终止应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用ios应用程式注册QuickBlox中的新用户时,登录和密码凭证,应用程序崩溃,NSLog控制台显示以下错误

While signing up a new userin QuickBlox from ios applicaqtion with login and Password credentials, the app got crashed and the NSLog console shows the error as below,


由于未捕获异常终止应用程序BaseServiceException ',
reason:'您错过了授权呼叫。请在应用程序中插入
下面的代码[QBRequest
createSessionWithSuccessBlock:errorBlock:];



First throw call stack:(
0   CoreFoundation                      0x038365e4 __exceptionPreprocess + 180
1   libobjc.A.dylib                     0x02ca48b6 objc_exception_throw + 44
2   VideoChat                           0x00028e2f -[QBHTTPConnection generateRequestOperation:forPath:usingMethod:] + 1231
3   VideoChat                           0x00028092 -[QBConnection executeRequest:forPath:usingMethod:] + 162
4   VideoChat                           0x0001b049 +[QBRequest(QBAuth) signUp:successBlock:errorBlock:] + 825
5   VideoChat                           0x0000457d -[AppDelegate application:didFinishLaunchingWithOptions:] + 2077
6   UIKit                               0x017ff355 -[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:] + 309
7   UIKit                               0x017ffb95 -[UIApplication _callInitializationDelegatesForURL:payload:suspended:] + 1536
8   UIKit                               0x018043a8 -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 824
9   UIKit                               0x0181887c -[UIApplication handleEvent:withNewEvent:] + 3447
10  UIKit                               0x01818de9 -[UIApplication sendEvent:] + 85
11  UIKit                               0x01806025 _UIApplicationHandleEvent + 736
12  GraphicsServices                    0x03d6b2f6 _PurpleEventCallback + 776
13  GraphicsServices                    0x03d6ae01 PurpleEventCallback + 46
14  CoreFoundation                      0x037b1d65 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 53
15  CoreFoundation                      0x037b1a9b __CFRunLoopDoSource1 + 523
16  CoreFoundation                      0x037dc77c __CFRunLoopRun + 2156
17  CoreFoundation                      0x037dbac3 CFRunLoopRunSpecific + 467
18  CoreFoundation                      0x037db8db CFRunLoopRunInMode + 123
19  UIKit                               0x01803add -[UIApplication _run] + 840
20  UIKit                               0x01805d3b UIApplicationMain + 1225
21  VideoChat                           0x00004cbd main + 141
22  libdyld.dylib                       0x033dc725 start + 0)

我使用下面的代码创建一个新用户,

I'm using the below code to create a new user,

[QBRequest createSessionWithSuccessBlock:^(QBResponse *response, QBASession *session) {
    // session created
} errorBlock:^(QBResponse *response) {
    // handle errors
    NSLog(@"%@", response.error);
}];

QBUUser *user = [QBUUser user];
user.password = @"azhhdsf";
user.login = @"dsfgsgf";

// Registration/sign up of User
[QBRequest signUp:user successBlock:^(QBResponse *response, QBUUser *user) {
    // Sign up was successful
} errorBlock:^(QBResponse *response) {
    // Handle error here
    NSLog(@"error while signing up with QB");
}];

我看到一个答案这里在SO ,但它抛出一个错误,委托:self 已被弃用,需要使用上述方法 signUp :successBlock:

I saw an answer here on SO, but it throws an error, that delegate:self was deprecated and need to use the above method signUp: successBlock:.

有没有人遇到这个问题?如何解决这个问题?任何建议将非常感激。

Did anyone face this issue? How to fix this? Any suggestions would be greatly appreciated.

推荐答案

所有这些请求都是异步的,你不能这样使用。

All these requests are asynchronous and you can't use it this way.

正确的方法是等待直到创建会话,然后注册一个用户:

The right way is to wait until session will be created and then sign up a user:

[QBRequest createSessionWithSuccessBlock:^(QBResponse *response, QBASession *session) {
    // session created

    QBUUser *user = [QBUUser user];
    user.password = @"azhhdsf";
    user.login = @"dsfgsgf";

    // Registration/sign up of User
    [QBRequest signUp:user successBlock:^(QBResponse *response, QBUUser *user) {
        // Sign up was successful
    } errorBlock:^(QBResponse *response) {
        // Handle error here
        NSLog(@"error while signing up with QB");
    }];
} errorBlock:^(QBResponse *response) {
    // handle errors
    NSLog(@"%@", response.error);
}];

这篇关于在从ios应用程序注册QuickBlox中的新用户时终止应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆