xmpp总是断线 怎样重连的问题

2016-08-29  本文已影响698人  三岁就很乖

因为我的xmpp掉线会输出


Error Domain=GCDAsyncSocketErrorDomain Code=7 "Socket closed by remote peer" UserInfo={NSLocalizedDescription=Socket closed by remote peer}
namespace warning : xmlns: URI vcard-temp is not absolute
<vCard xmlns="vcard-temp"/>

掉线打印输出

在这方法里我自己重连了xmpp

B9BB63B1-E894-4628-AA70-A2B91CC15259.png

在联系人的类里从原来的类的初始化 改成了下面

- (void)viewDidLoad {
    [super viewDidLoad];
    
    //roster改变的通知
    [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(rosterChange) name:kXMPP_ROSTER_CHAGE object:nil];
    //组 组状态数组的初始化
    _groups =  [[NSMutableArray alloc]init];
    _SectionStates = [[NSMutableArray alloc]init];

    self.tableView.frame = CGRectMake(0, 0, ScreenViewW, ScreenViewWH-100);
    self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
    self.tableView.delegate = self;
    self.tableView.dataSource = self;
    //获取联系人
    [self getGroups];

    
}

-(instancetype)init{
    
    if (self) {
        [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(rosterChange) name:kXMPP_ROSTER_CHAGE object:nil];
        _groups =  [[NSMutableArray alloc]init];
        _SectionStates = [[NSMutableArray alloc]init];
    }
    return self;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.tableView.frame = CGRectMake(0, 0, ScreenViewW, ScreenViewWH-100);
    self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
    self.tableView.delegate = self;
    self.tableView.dataSource = self;
    
}
-(void)viewWillAppear:(BOOL)animated{
    
    [super viewWillAppear:YES];
    [[xmppManager shareInstance]connectToXMMPP];
    
    [self getGroups];
}
上一篇下一篇

猜你喜欢

热点阅读