2016-05-04 1 views
0

私たちのアプリはPodfileを使って 'QuickBlox'をインクルードしましたが、新しいユーザーを正常に作成できません。ここには、すでに決められたユーザー名とパスワードを使用するコードがあります。私は明白な何かを欠いていますかQBRequest createSessionWithSuccessBlockメソッドは、SDKで使用されていないため使用できません。Quickbloxユーザーを作成しようとするとObjective-Cで "cancelled"と返されます

self.qbUser = [QBUUser user]; 
self.qbUser.login = self.user.userId; 
// 
// use salted SHA1 as password 
// 
self.qbUser.password = self.user.password; 

[SVProgressHUD show]; 
__weak typeof(self) weakSelf = self; 

// 
// block to start chat 
// 
void (^chatBlock)(QBUUser *) = ^(QBUUser *user) { 
    [[QBChat instance] connectWithUser:user completion:^(NSError * _Nullable error) { 
     NSLog(@"Chat Error: %@", error); 
     weakSelf.isLoggedInToQb = NO; 
    }]; 
}; 

// 
// block for logging in an already-created user 
// 
void (^loginBlock)(QBUUser *) = ^(QBUUser *startUser) { 
    [QBRequest logInWithUserLogin:startUser.login password:startUser.password successBlock:^(QBResponse *response, QBUUser *loggedInUser) { 
     weakSelf.isLoggedInToQb = YES; 
     chatBlock(startUser); 
    } errorBlock:^(QBResponse *response) { 
     // error handling 
     NSLog(@"error: %@", response.error); 
     weakSelf.isLoggedInToQb = NO; 
    }]; 
}; 

// 
// attempt to create the user 
// 
self.qbLoginRequest = [QBRequest signUp:self.qbUser successBlock:^(QBResponse * _Nonnull response, QBUUser * _Nullable user) { 
    [SVProgressHUD dismiss]; 
    // user created, go ahead and log in 
    loginBlock(user); 
} errorBlock:^(QBResponse * _Nonnull response) { 
    [SVProgressHUD dismiss]; 
    NSLog(@"Unable to create user to log in: %@", response.error.error); 
    NSLog(@"request was cancelled: %@", weakSelf.qbLoginRequest.canceled ? @"YES" : @"NO"); 
    // I would expect a status like QBUserAlreadyExists, but.. 
    //if(response.status == QBResponseStatusCodeOK) { 
     // try logging in anyway 
     loginBlock(weakSelf.qbUser); 
    //} 
}]; 

私は取得しています出力は、要求がself.qbLoginRequest.canceledがfalseであっても、キャンセルされたと言います。以下は、上のコードからのコンソール出力です。私は認証ステップを欠いていると思う。このセッションは最近、QuickBloxから削除されました。これは最初に確認する必要があります。

2016-05-04 10:12:50.397 charly[99771:16346643] [QBCore] Response error: Error Domain=NSURLErrorDomain Code=-999 "cancelled" UserInfo={NSErrorFailingURLKey=https://api.dev.quickblox.com/session.json, NSLocalizedDescription=cancelled, NSErrorFailingURLStringKey=https://api.dev.quickblox.com/session.json} 
2016-05-04 10:12:50.397 charly[99771:16346643] [QBCore] Response error reasons: { 
    error =  { 
     message = cancelled; 
    }; 
} 
2016-05-04 10:12:50.398 charly[99771:16346643] [QBAuth] Create Session request error: (null) 
2016-05-04 10:12:50.401 charly[99771:16346593] [QBCore] Response error: Error Domain=NSURLErrorDomain Code=-999 "cancelled" UserInfo={NSErrorFailingURLKey=https://api.dev.quickblox.com/session.json, NSLocalizedDescription=cancelled, NSErrorFailingURLStringKey=https://api.dev.quickblox.com/session.json} 
2016-05-04 10:12:50.401 charly[99771:16346342] Unable to create user to log in: Error Domain=NSURLErrorDomain Code=-999 "cancelled" UserInfo={NSErrorFailingURLKey=https://api.dev.quickblox.com/session.json, NSLocalizedDescription=cancelled, NSErrorFailingURLStringKey=https://api.dev.quickblox.com/session.json} 
2016-05-04 10:12:50.401 charly[99771:16346342] request was cancelled: NO 
2016-05-04 10:12:50.401 charly[99771:16346593] [QBCore] Response error reasons: { 
    error =  { 
     message = cancelled; 
    }; 
} 
2016-05-04 10:12:50.401 charly[99771:16346593] [QBCore] Request URL:https://api.dev.quickblox.com/session.json 
2016-05-04 10:12:50.401 charly[99771:16346593] [QBCore] Request method: POST 
2016-05-04 10:12:50.402 charly[99771:16346593] [QBCore] Request parameters:{ 
    "application_id" = 39734; 
    "auth_key" = c85fDePFNeGUkBh; 
    nonce = 319; 
    signature = d13c7681ea38fe7d3c6eff3a5fc1be251810401b; 
    timestamp = 1462371170; 
} 
2016-05-04 10:12:50.402 charly[99771:16346593] [QBCore] Request headers: { 
    "Accept-Language" = "en-US;q=1"; 
    "Content-Type" = "application/x-www-form-urlencoded"; 
    "QB-OS" = "iOS 9.3"; 
    "QB-SDK" = "iOS 2.7.2"; 
    "QuickBlox-REST-API-Version" = "0.1.1"; 
    "User-Agent" = "charly/1.0 (iPhone; iOS 9.3; Scale/3.00)"; 
} 
2016-05-04 10:12:50.470 charly[99771:16346593] [QBCore] Response error: Error Domain=NSURLErrorDomain Code=-999 "cancelled" UserInfo={NSErrorFailingURLKey=https://api.dev.quickblox.com/session.json, NSLocalizedDescription=cancelled, NSErrorFailingURLStringKey=https://api.dev.quickblox.com/session.json} 
2016-05-04 10:12:50.470 charly[99771:16346593] [QBCore] Response error reasons: { 
    error =  { 
     message = cancelled; 
    }; 
} 
2016-05-04 10:12:50.470 charly[99771:16346593] [QBAuth] Create Session request error: (null) 
2016-05-04 10:12:50.473 charly[99771:16346342] error: 
    Error reasons:{ 
    error =  { 
     message = cancelled; 
    }; 
} 
2016-05-04 10:12:50.473 charly[99771:16346593] [QBCore] Response error: Error Domain=NSURLErrorDomain Code=-999 "cancelled" UserInfo={NSErrorFailingURLKey=https://api.dev.quickblox.com/session.json, NSLocalizedDescription=cancelled, NSErrorFailingURLStringKey=https://api.dev.quickblox.com/session.json} 
2016-05-04 10:12:50.473 charly[99771:16346593] [QBCore] Response error reasons: { 
    error =  { 
     message = cancelled; 
    }; 
} 
2016-05-04 10:12:50.731 charly[99771:16346593] [QBCore] Answer DNS chat.quickblox.com [connectivity-1] 

セッションを追加しようとしましたが、コードがクラッシュしました。私はQBUUserの作成の上、コードがQBRequest signUpを呼び出す行にクラッシュしたことを置く場合

QBASession *session = [QBASession new]; 
[[QBSession currentSession] startSessionWithDetails:session]; 

+0

[github](https://github.com/QuickBlox/quickblox-ios-sdk)で問題を作成し、完全なログを添付してください。 フル・ログを有効にする場合:// Quickblox REST API呼び出しを有効にします。デバッグ・コンソール出力[QBSettings setLogLevel:QBLogLevelDebug]; //コンソール出力で詳細なXMPPログを有効にする[QBSettings enableXMPPLogging];あなたのご協力は非常に高く評価され、問題の解決能力を向上させるために役立ちます。 –

答えて

0

私は私のようQuickBloxの設定を初期化していた:

[QBSettings setApplicationID:kApplicationID]; 
[QBSettings setAuthKey:kAuthKey]; 
[QBSettings setAuthSecret:kAuthSecret]; 
[QBSettings setAccountKey:kAccountKey]; 
[QBSettings setAutoReconnectEnabled:YES]; 
[QBSettings setChatDNSLookupCacheEnabled:YES]; 
// for development 
QBSettings.serviceZone = QBConnectionZoneTypeDevelopment; 
QBSettings.networkIndicatorManagerEnabled = YES; 
[QBSettings enableXMPPLogging]; 

しかし、私は熱心されていました。私はいくつかの行をコメントアウトした場合、私はより良い結果を得る:

// [QBSettings setAutoReconnectEnabled:YES]; 
// [QBSettings setChatDNSLookupCacheEnabled:YES]; 
// // for development 
// QBSettings.serviceZone = QBConnectionZoneTypeDevelopment; 
// QBSettings.networkIndicatorManagerEnabled = YES; 
// [QBSettings enableXMPPLogging]; 

だから、問題はコメントアウトした線であると思われます。

関連する問題