美文网首页
xmpp总是断线 怎样重连的问题

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

作者: 三岁就很乖 | 来源:发表于2016-08-29 16:42 被阅读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];
    }
    

    相关文章

      网友评论

          本文标题:xmpp总是断线 怎样重连的问题

          本文链接:https://www.haomeiwen.com/subject/naoxettx.html