暖暖视频免费观**,国产免费美女被艹视频,毛片一级毛片,不卡三级

智慧服務,成就美好體驗 項目咨詢

主頁 > 服務與支持 > 開發(fā)平臺 > 客戶端SDK參考 > iOS Native SDK > 接口參考 通訊錄

入門使用

通訊錄

更新時間:2019-11-20

接口名稱

接口描述

tsdk_set_system_icon

設(shè)置系統(tǒng)頭像。

tsdk_set_user_def_icon

設(shè)置自定義頭像。

tsdk_get_user_icon

搜索聯(lián)系人頭像。

tsdk_search_contacts

搜索聯(lián)系人。

tsdk_set_system_icon

接口描述

設(shè)置系統(tǒng)頭像。

注意事項

無。

方法定義

TSDK_API TSDK_RESULT tsdk_set_system_icon(IN TSDK_UINT32 icon_id);
 

參數(shù)描述

參數(shù)名

是否必須

類型

描述

[in] icon_id

TSDK_UINT32

系統(tǒng)頭像序號。

返回值

類型

描述

TSDK_RESULT

成功返回TSDK_SUCCESS,失敗返回相應錯誤碼。

代碼示例

//OC
- (void)setSystemHead:(int)sysIconID withCmpletion:(void(^)(BOOL result))completionBlock {
    TSDK_RESULT set_sys_result = tsdk_set_system_icon((TSDK_UINT32)sysIconID);
    BOOL result = set_sys_result == TSDK_SUCCESS;
    if (completionBlock) {
        completionBlock(result);
    }
    if (result) {
        [self setHeadID:[NSString stringWithFormat:@"%d", sysIconID]];
    }
}
 

tsdk_set_user_def_icon

接口描述

設(shè)置自定義頭像。

注意事項

  • 設(shè)置自定義頭像需注意:自定義頭像信息里需要設(shè)置頭像的內(nèi)容以及內(nèi)容的長度,并且頭像需要選擇為小頭像52*52、中頭像120*120和大頭像320*320三種其中具體大小應根據(jù)服務器要求來定。
  • 圖片的格式不支持TIFF格式,推薦使用png格式。
  • 圖片的大小服務器沒有限制,產(chǎn)品可以根據(jù)實際的需要進行限制,建議圖片大小最大值為2MB。

方法定義

TSDK_API TSDK_RESULT tsdk_set_user_def_icon(IN TSDK_S_ICON_INFO* icon_info,  OUT TSDK_CHAR *update_time, IO TSDK_UINT32 *length);
 

參數(shù)描述

參數(shù)

是否必須

類型

描述

[in] icon_info

TSDK_S_ICON_INFO*

自定義頭像信息。

[out] update_time

TSDK_CHAR*

頭像更改時間,空間由上層適配提供。

[io] length

TSDK_UINT32*

頭像更新時間長度,傳入時為空間大小,傳出時為實際字串長度。

返回值

類型

描述

TSDK_RESULT

成功返回TSDK_SUCCESS,失敗返回相應錯誤碼。

代碼示例

//OC
- (void)setHeadImage:(UIImage *)image completion:(void(^)(BOOL result, NSString *headID))completionBlock {
    //自定義頭像接口需要上傳三種尺寸的圖片:52x52   120x120   320x320 
    NSData *minImg = [self imgWithSize:SIZE52 image:image];
    NSData *midImg = [self imgWithSize:SIZE120 image:image];
    NSData *maxImg = [self imgWithSize:SIZE320 image:image];
    NSString *path = NSTemporaryDirectory();
    NSString *iconPathMinImg = [path stringByAppendingPathComponent:@"minImg"];
    NSString *iconPathMidImg = [path stringByAppendingPathComponent:@"midImg"];
    NSString *iconPathMaxImg = [path stringByAppendingPathComponent:@"maxImg"];
    [minImg writeToFile:iconPathMinImg atomically:YES];
    [midImg writeToFile:iconPathMidImg atomically:YES];
    [maxImg writeToFile:iconPathMaxImg atomically:YES];
    
    TSDK_S_ICON_INFO* icon_info = (TSDK_S_ICON_INFO*)malloc(sizeof(TSDK_S_ICON_INFO));
    memset(icon_info, 0, sizeof(TSDK_S_ICON_INFO));
    strcpy(icon_info->small_icon_path, [iconPathMinImg UTF8String]);
    strcpy(icon_info->medium_icon_path, [iconPathMidImg UTF8String]);
    strcpy(icon_info->large_icon_path, [iconPathMaxImg UTF8String]);

    TSDK_CHAR *modifyTime = (TSDK_CHAR *)malloc(16);
    memset_s(modifyTime, 16, 0, 16);
    TSDK_UINT32 length = 16;
    
    TSDK_RESULT ret_set_def = tsdk_set_user_def_icon(icon_info, modifyTime, &length);
    free(icon_info);
    // 出參modifyTime時間戳,作為聯(lián)系人headId
    NSString *mTime = [NSString stringWithUTF8String:modifyTime];
    DDLogInfo(@"set image ret: %d modify time: %@", length, mTime);
    BOOL result = ret_set_def == TSDK_SUCCESS;
    if (completionBlock) {
        completionBlock(result, mTime);
    }
    if (result) {
        [self setHeadID:mTime];
    }
    
}
 

tsdk_get_user_icon

接口描述

獲取聯(lián)系人頭像。

注意事項

無。

方法定義

TSDK_API TSDK_RESULT tsdk_get_user_icon(IN TSDK_S_GET_ICON_PARAM *icon_param);
 

參數(shù)描述

參數(shù)名

是否必須

類型

描述

[in] icon_param

TSDK_S_GET_ICON_PARAM*

獲取頭像請求參數(shù)。

返回值

類型

描述

TSDK_RESULT

成功返回TSDK_SUCCESS,失敗返回相應錯誤碼。

代碼示例

//OC
- (void)loadPersonHeadIconWithAccount:(NSString *)account {
    TSDK_S_GET_ICON_PARAM *iconParam = (TSDK_S_GET_ICON_PARAM *)malloc(sizeof(TSDK_S_GET_ICON_PARAM));
    memset(iconParam, 0, sizeof(TSDK_S_GET_ICON_PARAM));
    if (account.length > 0 && account != nil) {
        strcpy(iconParam->account, [account UTF8String]);
    }
    iconParam->seq_no = rand();
    TSDK_RESULT result = tsdk_get_user_icon(iconParam);
    DDLogInfo(@"tsdk_get_user_icon result: %d", result);
    free(iconParam);
}
 

tsdk_search_contacts

接口描述

搜索聯(lián)系人。

注意事項

無。

方法定義

TSDK_API TSDK_RESULT tsdk_search_contacts(IN const TSDK_S_SEARCH_CONTACTS_PARAM* search_param);
 

參數(shù)描述

參數(shù)名

是否必須

類型

描述

[in] search_param

const TSDK_S_SEARCH_CONTACTS_PARAM*

搜索聯(lián)系人請求參數(shù)。

返回值

類型

描述

TSDK_RESULT

成功返回TSDK_SUCCESS,失敗返回相應錯誤碼。

代碼示例

//OC
- (void)searchContactWithParam:(SearchParam *)searchParam {
    TSDK_S_SEARCH_CONTACTS_PARAM *tsdkSearchParam = (TSDK_S_SEARCH_CONTACTS_PARAM *)malloc(sizeof(TSDK_S_SEARCH_CONTACTS_PARAM));
    memset(tsdkSearchParam, 0, sizeof(TSDK_S_SEARCH_CONTACTS_PARAM));
    if (searchParam.acSearchItem.length > 0 && searchParam.acSearchItem != nil) {
        strcpy(tsdkSearchParam->search_keyword, [searchParam.acSearchItem UTF8String]);
    }
    tsdkSearchParam->page_index = searchParam.ulPageIndex;
    tsdkSearchParam->is_exact_search = searchParam.ulExactSearch;
    
    if (searchParam.acDepId.length > 0 && searchParam.acDepId != nil && ![searchParam.acDepId isEqualToString:@"-1"])
    {
        strcpy(tsdkSearchParam->department_id, [searchParam.acDepId UTF8String]);
    }
    tsdkSearchParam->seq_no = searchParam.ulSeqNo;
    
    TSDK_RESULT result = tsdk_search_contacts(tsdkSearchParam);
    DDLogInfo(@"tsdk_search_contacts result: %d",result);
    free(tsdkSearchParam);
}