QuickBlox iOS问题 - 未验证密码

时间:2014-08-21 18:30:02

标签: ios objective-c quickblox

您好我在我的ios应用中使用quickblox SDK进行视频聊天 - 我试着在我的Appdelegate.m中编写QBChat代表 - 从任何视图确定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

错误在哪里? 请帮我解决这个问题。

1 个答案:

答案 0 :(得分:1)

你可以自己编写所有quickblox委托方法,当有来电时,你可以在其他视图上启动视频通话。