2

I'm trying to connect to a remote server using XMPPFramework in an iOS application. The app connects fine to both my openfire server on localhost and my public jabber account. Only when I try to connect to the dev server of my university it just wouldn't work and none of the delegate methods are being called. Neither is the NSError object passed to the connect method populated with anything.

Basically I'm connecting with the following code:

- (BOOL)connect {
    if ([xmppStream isConnected]) {
        return YES;
    }

    [xmppStream setMyJID:jabberID];
    [xmppStream setHostName:[self hostName]];

    NSError* error = nil;
    if (![xmppStream connect:&error]) {
        NSLog(@"Couldn't connect because of error: %@", [error localizedDescription]);
        return NO;
    }

    return YES;
}

I inserted plenty of log statements that show that all values are correct, and as I said, it works for my other JID.

I also tried using the IP address as hostname, without success.

Another suspicion I had was that the connection process gets stuck when the server sends an untrusted certificate, but I added it to the keychain from Adium and it still doesn't work.

So what could the problem possibly be? I'm able to connect to any other server I have available for testing, and I can also connect to the dev server in question with Adium, but not in my app using XMPPFramework.

4

1 回答 1

0

The problem was that the server required secure connections, and somehow I wasn't able to do that using XMPPFramework. I had my advisor at the university set the server settings to optional secure connections and now it works.

于 2013-07-17T11:28:52.400 回答