xmpp流确实在ios连接后断开了呼叫?

时间:2016-05-20 06:33:27

标签: ios iphone openfire xmppframework

您好我正在使用xmpp框架工作到昨天但是我不知道突然发生了什么xmpp didDisConnect方法调用

- (void)xmppStreamDidDisconnect:(XMPPStream *)sender withError:(NSError *)error

我缺少的地方。我知道如果用户名密码错误则会断开连接。但是我检查了我的用户名它很好,它显示如下错误

Error Domain=GCDAsyncSocketErrorDomain Code=4 "Read operation timed out" UserInfo={NSLocalizedDescription=Read operation timed out

下面是连接方法

- (BOOL)connect
 {

if (![xmppStream isDisconnected]) {
    return YES;
}
myJID =[NSString stringWithFormat:@"%@@servername",[[NSUserDefaults standardUserDefaults] stringForKey:@"FinalUserNameJID"]];


NSString *password1=[[NSUserDefaults standardUserDefaults] stringForKey:@"smsVerificationNumber"];

// If you don't want to use the Settings view to set the JID,
// uncomment the section below to hard code a JID and password.
//
// myJID = @"user@gmail.com/xmppframework";
// myPassword = @"";

if (myJID == nil || password1 == nil) {
    return NO;
}


[xmppStream setMyJID:[XMPPJID jidWithString:myJID]];
password = password1;

NSError *error = nil;

if (![xmppStream connectWithTimeout:XMPPStreamTimeoutNone error:&error])
{

    UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Error connecting"
                                                        message:@"See console for error details."
                                                       delegate:nil
                                              cancelButtonTitle:NSLocalizedString( @"O_K", @"OK")
                                              otherButtonTitles:nil];
    [alertView show];

    DDLogError(@"Error connecting: %@", error);

    return NO;
}


return YES;

}

如果有人面对这个问题,请帮助我.Thankyou

0 个答案:

没有答案