IOS腾讯云通信获取好友列表及修改备注

2019-11-04 16:21:11 浏览数 (1)

1.官网文档

2.因为集成了UI库,新建控制器继承TUIContactController,调取好友列表接口获取数据

代码语言:javascript复制
 [[TIMFriendshipManager sharedInstance] getFriendList:^(NSArray<TIMFriend *> *friends) {
         [IHUtility removeWaitingView];
           for (TIMFriend *friend in friends) {
               TCommonContactCellData *data = [[TCommonContactCellData alloc] initWithFriend:friend];
               data.avatarUrl = [NSURL URLWithString:friend.profile.faceURL];
                [_dataArray addObject:data];
           }
           self.dataScource = _dataArray;
       } fail:nil];
  1. 修改好友备注

关键代码:

代码语言:javascript复制
 [[TIMFriendshipManager sharedInstance] modifyFriend:self.idendientID values:@{ TIMFriendTypeKey_Remark: _tellPhone.text} succ:^{
           [self performSelector:@selector(delayMethod) withObject:nil afterDelay:2.0];
    } fail:^(int code, NSString *msg) {
         [IHUtility removeWaitingView];
        [WHToast showMessage:@"修改失败,请重新修改!" duration:1.5f finishHandler:^{}];
    }];

0 人点赞