JCSDK-iOS
|
#import <JCClient.h>
构造函数 | |
(bool) | - login:password: |
(bool) | - login:password:loginParam: |
(bool) | - logout |
(bool) | - setConfig:value: |
(void) | - setAppkey: |
(NSString *__nullable) | - getConfig: |
(int) | - sendOnlineMessage:userId: |
类方法 | |
(JCClient *__nullable) | + create:callback:extraParams: |
(void) | + destroy |
属性 | |
NSString *__nonnull | userId |
NSString *__nonnull | displayName |
JCClientState | state |
用于初始化sdk以及登录 Juphoon Cloud 平台
+ (JCClient* __nullable) create: | (NSString *__nonnull) | appKey | |
callback: | (id< JCClientCallback > __nonnull) | callback | |
extraParams: | (NSDictionary *__nullable) | extraParams | |
创建 JCClient 对象
JCClient 的所有接口函数,如无特殊说明,都建议在主线程调用
appKey | 用户从 Juphoon Cloud 平台上申请的 AppKey 字符串 |
callback | JCClientCallback 对象,用于回调相关通知 |
extraParams | 额外参数,没有则填null。传 null 则使用默认值 |
appKey、JCClientCallback 任意一个参数传空就会返回 nil |
- (NSString* __nullable) getConfig: | (NSString *__nonnull) | key |
获取配置相关参数
key | 参数关键字, |
- (bool) login: | (NSString *__nonnull) | userId | |
password: | (NSString *__nonnull) | password | |
- (bool) login: | (NSString *__nonnull) | userId | |
password: | (NSString *__nonnull) | password | |
loginParam: | (JCClientLoginParam *__nullable) | loginParam | |
登录 Juphoon Cloud 平台
只有登录成功后才能进行平台上的各种业务
userId | 用户名,长度在 64 字节以内的字符串。以下为支持的字符集范围(共 66 个字符):
|
password | 密码,不能为 nil 或 "",长度不能超过 128 字符 |
loginParam | 登录参数,一般不需要设置,如需设置请询问客服,传 nil 则按默认值,详见 JCClientLoginParam |
- (bool) logout |
- (int) sendOnlineMessage: | (NSString *__nonnull) | message | |
userId: | (NSString *__nonnull) | userId | |
发送在线消息
message | 消息内容 |
userId | 对方的 id |
- (void) setAppkey: | (NSString *__nonnull) | appKey |
设置appkey
appKey | appKey |
- (bool) setConfig: | (NSString *__nonnull) | key | |
value: | (NSString *__nonnull) | value | |
设置配置相关参数 JCClientConfigServer, JCClientConfigHttpsProxy 均需要在 login 之前调用
key | 参数关键字, |
value | 参数值 |
|
readwritenonatomiccopy |
获取/设置自己的昵称
以下情况时,都会将自己的昵称发送给其他用户:
|
readnonatomicassign |
获取当前登录状态
|
readnonatomiccopy |
获取用户标识
返回的的用户标识就是用户在调用 login 方法时传入的 userId 参数
需要注意的是只有用户状态为登录中或已登录才能获取到值,其他状态将返回 nil