0

I'm new to Quickblox for iOS and trying to login user to QBChat but I'm receiving unrecognized selector.

Here is the code:

if ([result isKindOfClass:[QBAAuthSessionCreationResult class]]) {
  QBUUser *currentUser=[QBUUser user];
  currentUser.login=@"test0123";
   currentUser.password=@"test0123";

if (result.success) {
    // Session is created...
    //Login to QuickBlox Chat
    [[QBChat instance] setDelegate: self];
    [[QBChat instance] loginWithUser: currentUser];
  }
}

I am receiving following log:

-[QBChat loginWithUser:] -> Connecting to Chat, hostName: chat.quickblox.com
-[QBChat loginWithUser:] -> Chat server endpoint: chat.quickblox.com, User JID:xxxxxxxx
-[QBDDXMLElement attributeFloatValueForName:withDefaultValue:]: unrecognized selector sent to instance 0x17442b0e0.

Mustafa
  • 20,504
  • 42
  • 146
  • 209
PhilT
  • 1
  • 1

2 Answers2

0

Try this:

if ([result isKindOfClass:[QBAAuthSessionCreationResult class]]) {

    if (result.success) {
        QBAAuthSessionCreationResult *res = (QBAAuthSessionCreationResult *)result;
        QBUUser *currentUser = [QBUUser user];

        currentUser.ID = res.session.userID;
        currentUser.login = self.sessionLogin;
        currentUser.password = self.sessionPassword;

        if ([[QBChat instance] isLoggedIn] == NO) {
            [[QBChat instance] setDelegate:self];
            [[QBChat instance] loginWithUser:currentUser];
        }

    } else {
        // Handle error
    }
}
Mustafa
  • 20,504
  • 42
  • 146
  • 209
  • Thank you for improving my question. But I'm still receiving the same logged error. I have followed a previous answer: [link](http://stackoverflow.com/questions/14140132/creating-chat-room-in-quickblox) in hopes to solve this issue but the issue persists. – PhilT Mar 19 '15 at 05:44
  • Generally, you should follow the steps on quickblox website instead, which is more up to date: http://quickblox.com/developers/SimpleSample-chat_users-ios – Mustafa Mar 19 '15 at 06:57
  • Experiencing similar unrecognized selector error with this method: `[QBRequest createSessionWithExtendedParameters:parameters successBlock:^(QBResponse *response, QBASession *session) {}` – PhilT Mar 20 '15 at 01:34
  • You should run, test, and debug the SimpleSample-chat application provided by Quickblox. It might give you some insight into what you're missing. That's the only help/advice I can give you, considering the available information. – Mustafa Mar 20 '15 at 10:55
0

If you have an old SDK, please try new SDK with CocoaPods http://quickblox.com/developers/IOS-how-to-connect-Quickblox-framework#CocoaPods

And also please try sample projects https://github.com/QuickBlox/quickblox-ios-sdk

they have the same logic that you have and everything works without crashes

SevenDays
  • 3,718
  • 10
  • 44
  • 71
  • Thank you for the advice! I've gone the cocoapods and ios sample project route and stumbled on the main issue: in QBDDXMLNode.h which states: "Lexical or Preprocessor Issue 'libxml/tree.h' file not found." Any ideas? And yes...I have added the frameworks and the necessary flags to the Other Linker Flags. – PhilT Mar 23 '15 at 13:57
  • use Google :) http://stackoverflow.com/questions/26857531/import-libxml-tree-h-file-not-found-after-xcode-6-1-update http://stackoverflow.com/questions/14622684/import-libxml-tree-h-file-not-found-after-xcode-update – SevenDays Mar 23 '15 at 16:18
  • @PhilT also please ensure you set -ObjC in linker flags. – SevenDays Apr 15 '15 at 10:19