QuickBlox iOS问题-密码未验证



嗨,我使用quickblox SDK在我的ios应用程序视频聊天-我试图在我的Appdelegate中编写QBChat delegate。m -从任何视图判断QuickBlox调用何时到来

我的代码-

LoginViewController.m

 -(IBAction)loginBtn:(id)sender{
  [QBUsers logInWithUserLogin:username.text password:password.text delegate:self];
  }

 -(void)completedWithResult:(Result *)result{
 if([result isKindOfClass:[QBUUserLogInResult class]]){
     if(result.success){
        QBUUserLogInResult *res = (QBUUserLogInResult *)result;
        appDelegate.currentUser = res.user;
        NSLog(@"QBid-----%d",res.user.ID);   // I am getting ID here
       [appDelegate QBLogin:self];


    }
      else
        //Errors
     }
  }

AppDelegate.m

-(BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
  {
[QBSettings setApplicationID:13504];
[QBSettings setAuthorizationKey:@"vfte-wg7D2VB4Q"];
[QBSettings setAuthorizationSecret:@"uhytrhqBzFz8eKJ2p"];
[QBSettings setAccountKey:@"b7zksdft56de5q4xX7"];
[QBAuth createSessionWithDelegate:self];
}

-(void)QBLogin:(id)sender{

  // Create session with user
 QBASessionCreationRequest *extendedAuthRequest = [QBASessionCreationRequest request];
 extendedAuthRequest.userLogin = @"mysavedusername";
extendedAuthRequest.userPassword = @"mysavedpassword";
[QBAuth createSessionWithExtendedRequest:extendedAuthRequest delegate:self];

[QBChat instance].delegate = self;
[NSTimer scheduledTimerWithTimeInterval:30 target:[QBChat instance] selector:@selector(sendPresence) userInfo:nil repeats:YES];
 }

 -(void)completedWithResult:(Result *)result{
    if(result.success && [result isKindOfClass:QBAAuthSessionCreationResult.class]){
   QBAAuthSessionCreationResult *res = (QBAAuthSessionCreationResult *)result;

    QBUUser *currentUser2 = [QBUUser user];
    currentUser2.ID = res.session.userID; 
    currentUser2.password =  @"mysavedpassword";
    [QBChat instance].delegate = self;
     [[QBChat instance] loginWithUser:currentUser];
     }
   else
     //  Error
  }




  -(void) chatDidLogin{
    }

   -(void) chatDidReceiveCallRequestFromUser:(NSUInteger)userID withSessionID:(NSString *)_sessionID conferenceType:(enum QBVideoChatConferenceType)conferenceType{

   videoChatOpponentID = userID;
   videoChatConferenceType = conferenceType;
   sessionID = _sessionID;
   self.videoChat = [[QBChat instance] createAndRegisterVideoChatInstanceWithSessionID:sessionID];


   if (self.callAlert == nil) {
    //@"person is calling. Would you like to answer?"];
    }

   [NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(hideCallAlert) object:nil];
[self performSelector:@selector(hideCallAlert) withObject:nil afterDelay:4];

  }


-(void) chatCallUserDidNotAnswer:(NSUInteger)userID{
//@"User isn't answering. Please try again
    }
  -(void) chatCallDidRejectByUser:(NSUInteger)userID{

  //@"User has rejected your call
    }
-(void) chatCallDidAcceptByUser:(NSUInteger)userID{
  }
-(void) chatCallDidStopByUser:(NSUInteger)userID status:(NSString *)status{
  }

在这里我得到这个错误信息后成功登录

   -[QBChat loginWithUser:] -> Connecting to Chat, hostName: muc.chat.quickblox.com
  -[QBChat loginWithUser:] -> Chat server endpoint: muc.chat.quickblox.com, User JID: 1480900-13504@chat.quickblox.com/1280B391-492D-4C6E-9C72-F832D0D7D78F
   QBChat/didConnect
   QBChat/didNotAuthenticate, error: <failure xmlns="urn:ietf:params:xml:ns:xmpp-sasl"><not-authorized/><text lang="en">Password not verified</text></failure>
 -[QBContactList dealloc] -> 
  QBChat/didDisconnect, error: (null)
 -[QBChat sendPresence] -> return. You have to be logged in in order to use Chat API

错误在哪里?

你可以在appdelegate中编写所有的quickblox delegate方法,当调用来的时候,你可以在其他视图上启动视频调用

最新更新