Question

I have an existing ios app that was created using the Parse PFLoginController for Facebook/Twitter login. I want to add a new tab for video chat and was wondering if there is a simple way to create a QBUser out of an existing PFUser to use for chat.

Thanks, EE

Was it helpful?

Solution

PFUser class reference https://www.parse.com/docs/ios/api/Classes/PFUser.html

QBUser class reference http://sdk.quickblox.com/ios/Classes/QBUUser.html

PFUser *pfUser = [PFUser currentUser];

QBUUser *user = [QBUUser user];
user.ID = pfUser.objectId;
user.login = pfUser.username;
user.email = pfUser.email;
user.password = pfUser.password;

If you use Facebook login - it's also easy to do it - you just need Facebook access token. You can get QBUser from Facebook access token

[QBUsers logInWithSocialProvider:@"facebook" accessToken:@"AAAGmLYiu1lcBADxROiXg4okE80FQO1dJHglsbNT3amxmABnmBmhN6ACbgDqNC3H4Y9GmZAdoSfPUkI9O7ZBJvKQCewNZAp3SoxKCNIMwQZDZD3" accessTokenSecret:nil delegate:self]; 

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

         QBUUser *user = res.user;

         // Login to chat to use VideoChat features
         QBUUser *currentUser = [QBUUser user];
         currentUser.ID = user.ID; 
         currentUser.password = [QBBaseModule sharedModule].token;  //Facebook/Twitter authentication: use session token as password

         // set Chat delegate
         [QBChat instance].delegate = self;

         // login to Chat
         [[QBChat instance] loginWithUser:currentUser];
     }
 }

OTHER TIPS

I've never heard of QB until now. It looks like a cool service, so I'll have to check it out. That said, since I've never messed with it, this is all theoretical.

I've got a couple apps that I've built a generic chat implementation using Parse, so it would be neat to transition to a true messaging based platform. The way I would do it, instead of having people sign up for two different accounts, if you still need the Parse back-end for data persistence, is to have your Parse users just be anonymous. When creating PFObject data for Parse, just create a field for the QBUser's ID number. Then if you need to find info pertaining to that anonymous user, set your PFQuery to search for the ID field for the given QBUser.

It's not completely thought through but I could see it working out.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top