Commit 256efb0db715bcb7f3c67263760d37b8c83c60f8

Authored by 王军波
1 parent a51626d8

CNLiveChatSDKDemo

Showing 35 changed files with 2947 additions and 0 deletions
CNLiveChatSDKDemo/CNLiveChatManager.framework/CNLiveChatManager 0 → 100755
No preview for this file type
CNLiveChatSDKDemo/CNLiveChatManager.framework/Headers/CNLiveChatManager.h 0 → 100644
  1 +//
  2 +// CNLiveChatManager.h
  3 +// CNLiveChatManager
  4 +//
  5 +// Created by cnliveJunBo on 17/2/27.
  6 +// Copyright © 2017年 cnlive. All rights reserved.
  7 +//
  8 +
  9 +#import <Foundation/Foundation.h>
  10 +#import "CNLiveChatUserInfo.h"
  11 +#import "CNLiveChatStatusDefine.h"
  12 +#import "CNLiveChatMessage.h"
  13 +
  14 +@protocol CNLiveChatManagerDelegate <NSObject>
  15 +
  16 +@optional
  17 +/**
  18 + 连接状态的的监听器
  19 +
  20 + @param status 网络连接状态码
  21 + */
  22 +- (void)onConnectionStatusChanged:(CNLiveConnectionStatus)status;
  23 +
  24 +
  25 +/**
  26 + 加入聊天室成功的监听
  27 + @param chatroomId 聊天室ID
  28 + */
  29 +- (void)onChatRoomJoined:(NSString *)chatroomId;
  30 +
  31 +
  32 +/*!
  33 + 加入聊天室失败的监听
  34 +
  35 + @param chatroomId 聊天室ID
  36 + @param errorCode 加入失败的错误码
  37 +
  38 + @discussion 如果错误码是CNLive_KICKED_FROM_CHATROOM或CNLive_CHATROOM_NOT_EXIST,则不会自动重新加入聊天室,App需要按照自己的逻辑处理。
  39 + */
  40 +- (void)onChatRoomJoinFailed:(NSString *)chatroomId
  41 + errorCode:(CNLiveChatErrorCode)errorCode;
  42 +
  43 +/**
  44 + 接收消息监听
  45 +
  46 + @param message 消息实体类型对象
  47 + */
  48 +- (void)onReceived:(CNLiveChatMessage *)message;
  49 +
  50 +
  51 +/**
  52 + 当前用户在其他设备上登录,此设备被踢下线。
  53 + */
  54 +- (void)kickedByAnotherDevice;
  55 +
  56 +@end
  57 +
  58 +@interface CNLiveChatManager : NSObject
  59 +
  60 +/**
  61 + 聊天SDK代理,设置代理后,实现代理方法。
  62 + */
  63 +@property (nonatomic, weak) id<CNLiveChatManagerDelegate> delegate;
  64 +
  65 +/**
  66 + 当前登录用户的用户信息
  67 +
  68 + @discussion 用于与融云服务器建立连接之后,获取&设置当前用户的用户信息。
  69 + 用户ID不允许重新设置,只能设置昵称&头像。
  70 + */
  71 +@property(nonatomic, strong) CNLiveChatUserInfo *currentUserInfo;
  72 +
  73 +/**
  74 + 获取SDK版本号
  75 +
  76 + @return SDK版本号
  77 + */
  78 ++ (NSString *)getVersion;
  79 +
  80 +
  81 +/**
  82 + 获取视讯聊天核心类单例
  83 +
  84 + @return 视讯聊天核心类单例
  85 +
  86 + @discussion 您可以通过此方法,获取视讯聊天的单例,访问对象中的属性和方法。
  87 + */
  88 ++ (instancetype)sharedCNLiveChatManager;
  89 +
  90 +
  91 +/**
  92 + 初始化SDK方法
  93 +
  94 + @param appKey 从视讯云平台获取到的appKey
  95 + @param appId 从视讯云平台获取到的appId
  96 + @warning 必传参数
  97 + @discussion 您在使用聊天SDK所有功能之前,您必须先调用此方法初始化SDK。
  98 + 在App整个生命周期中,您只需要执行一次初始化。
  99 + */
  100 +- (void)initWithAppKey:(NSString *)appKey appId:(NSString *)appId;
  101 +
  102 +
  103 +/**
  104 + 连接到视讯云服务器
  105 +
  106 + @param successBlock 连接建立成功的回调。
  107 + @param errorBlock 连接建立成功的回调,返回错误码。
  108 + 注:连接服务器成功后才能使用聊天功能(如:单聊、加入聊天室、聊天室内 聊天);
  109 + */
  110 +- (void)connectServerSuccess:(void (^)())successBlock
  111 + error:(void (^)(CNLiveChatConnectErrorCode errors))errorBlock;
  112 +
  113 +/**
  114 + 以用户信息登陆到视讯云服务器
  115 +
  116 + @param userInfo 用户信息
  117 + @param successBlock 登陆成功的回调,返回登陆成功的用户ID。
  118 + @param errorBlock 登陆失败的回调,返回错误码。
  119 + 注:连接服务器成功后才能使用聊天功能(如:单聊、加入聊天室、聊天室内 聊天);
  120 + */
  121 +- (void)loginServer:(CNLiveChatUserInfo *)userInfo
  122 + success:(void (^)(NSString *userId))successBlock
  123 + error:(void (^)(CNLiveChatConnectErrorCode errors))errorBlock;
  124 +
  125 +
  126 +/**
  127 + 当前用户登出服务器
  128 + */
  129 +- (void)logoutServer;
  130 +
  131 +
  132 +/**
  133 + 断开与服务器的连接
  134 +
  135 + @param isReceivePush 与服务器断开后,是否还接收远程推送
  136 + */
  137 +- (void)disconnectServer:(BOOL)isReceivePush;
  138 +
  139 +
  140 +/**
  141 + 加入已经存在的聊天室(如果不存在或超限会返回聊天室不存在错误23410 或 人数超限23411)
  142 +
  143 + @param targetId 要加入的聊天室ID
  144 + @param messageCount 进入聊天室时获取历史消息的数量,-1<=messageCount<=50
  145 + -1表示不获取任何历史消息,0表示不特殊设置而使用SDK默认的设置(默认为获取10条),0<messageCount<=50为具体获取的消息数量,最大值为50。
  146 + @param successBlock 加入聊天室成功的回调,返回成功加入的聊天室ID。
  147 + @param errorBlock 加入聊天室失败的回调,返回错误码以及加入失败的聊天室ID。
  148 + */
  149 +- (void)joinExistChatRoom:(NSString *)targetId
  150 + messageCount:(int)messageCount
  151 + success:(void (^)(NSString *targetId))successBlock
  152 + error:(void (^)(CNLiveChatErrorCode errors, NSString *targetId))errorBlock;
  153 +
  154 +
  155 +/**
  156 + 加入聊天室,若不存在自动创建聊天室
  157 +
  158 + @param targetId 要加入的聊天室ID
  159 + @param messageCount 进入聊天室时获取历史消息的数量,-1<=messageCount<=50
  160 + -1表示不获取任何历史消息,0表示不特殊设置而使用SDK默认的设置(默认为获取10条),0<messageCount<=50为具体获取的消息数量,最大值为50。
  161 + @param successBlock 加入聊天室成功的回调,返回成功加入的聊天室ID
  162 + @param errorBlock 加入聊天室失败的回调,返回错误码以及加入失败的聊天室ID
  163 + */
  164 +- (void)joinChatRoom:(NSString *)targetId
  165 + messageCount:(int)messageCount
  166 + success:(void (^)(NSString *targetId))successBlock
  167 + error:(void (^)(CNLiveChatErrorCode errors, NSString *targetId))errorBlock;
  168 +
  169 +
  170 +/**
  171 + 退出聊天室
  172 +
  173 + @param targetId 要退出的聊天室ID
  174 + @param successBlock 退出聊天室成功的回调,返回成功退出的聊天室ID
  175 + @param errorBlock 退出聊天室失败的回调,返回失败的错误码以及退出失败的聊天室的ID
  176 + */
  177 +- (void)quitChatRoom:(NSString *)targetId
  178 + success:(void (^)(NSString *targetId))successBlock
  179 + error:(void (^)(CNLiveChatErrorCode errors, NSString *targetId))errorBlock;
  180 +
  181 +
  182 +/**
  183 + 发送消息
  184 +
  185 + @param message 消息内容
  186 + @param type 会话类型(私聊 / 聊天室)
  187 + @param targetId 会话目标ID(私聊:用户ID / 聊天室:聊天室ID)
  188 + @param successBlock 发送消息成功的回调,返回目标ID,消息实体类型对象(包括消息内容,会话类型,目标ID,发送者的用户信息)
  189 + @param errorBlock 发送消息失败的回调,返回错误码,目标ID,会话类型
  190 + */
  191 +- (void)sendMessage:(NSString *)message
  192 + type:(CNLiveConversationType)type
  193 + targetId:(NSString *)targetId
  194 + success:(void (^)(NSString *targetId, CNLiveChatMessage *message))successBlock
  195 + error:(void (^)(CNLiveChatErrorCode errors, NSString *targetId, CNLiveConversationType type))errorBlock;
  196 +
  197 +
  198 +/**
  199 + 获取当前SDK的连接状态
  200 +
  201 + @return 当前SDK的连接状态
  202 + */
  203 +- (CNLiveConnectionStatus)getConnectionStatus;
  204 +
  205 +
  206 +/**
  207 + 获取某个会话中指定数量的最新消息
  208 +
  209 + @param conversationType 会话类型(私聊 / 聊天室)
  210 + @param targetId 会话目标ID(私聊:用户ID / 聊天室:聊天室ID)
  211 + @param count 所要获取的消息数量
  212 +
  213 + @return 消息数组(CNLiveChatMessage类型)
  214 + */
  215 +- (NSArray *)getLatestMessages:(CNLiveConversationType)conversationType
  216 + targetId:(NSString *)targetId
  217 + count:(int)count;
  218 +
  219 +
  220 +@end
CNLiveChatSDKDemo/CNLiveChatManager.framework/Headers/CNLiveChatMessage.h 0 → 100644
  1 +//
  2 +// CNLiveChatMessage.h
  3 +// CNLiveChatManager
  4 +//
  5 +// Created by cnliveJunBo on 17/3/3.
  6 +// Copyright © 2017年 cnlive. All rights reserved.
  7 +//
  8 +
  9 +#import <Foundation/Foundation.h>
  10 +#import "CNLiveChatStatusDefine.h"
  11 +#import "CNLiveChatUserInfo.h"
  12 +
  13 +@interface CNLiveChatMessage : NSObject
  14 +
  15 +/**
  16 + 会话类型(私聊 / 聊天室)
  17 + */
  18 +@property (nonatomic, assign) CNLiveConversationType conversationType;
  19 +
  20 +/**
  21 + 目标ID(消息来自聊天室的ID / 接收者ID)
  22 + */
  23 +@property (nonatomic, assign) NSString *targetId;
  24 +
  25 +/**
  26 + 消息内容
  27 + */
  28 +@property (nonatomic, strong) NSString *messageContent;
  29 +
  30 +/**
  31 + 发送者的用户信息(userId, name, portraitUri)
  32 + */
  33 +@property (nonatomic, strong) CNLiveChatUserInfo *userInfo;
  34 +
  35 +@end
CNLiveChatSDKDemo/CNLiveChatManager.framework/Headers/CNLiveChatStatusDefine.h 0 → 100644
  1 +//
  2 +// CNLiveChatStatusDefine.h
  3 +// CNLiveChatManager
  4 +//
  5 +// Created by cnliveJunBo on 17/3/1.
  6 +// Copyright © 2017年 cnlive. All rights reserved.
  7 +//
  8 +
  9 +#import <Foundation/Foundation.h>
  10 +
  11 +#pragma mark - 错误码相关
  12 +
  13 +#pragma mark CNLiveChatConnectErrorCode - 建立连接返回的错误码
  14 +/*!
  15 + 建立连接返回的错误码
  16 +
  17 + @discussion
  18 + 开发者仅需要关注以下几种连接错误码,其余错误码SDK均会进行自动重连,开发者无须处理。
  19 + CNLive_CONN_ID_REJECT, CNLive_CONN_TOKEN_INCORRECT, CNLive_CONN_NOT_AUTHRORIZED,
  20 + CNLive_CONN_PACKAGE_NAME_INVALID, CNLive_CONN_APP_BLOCKED_OR_DELETED,
  21 + CNLive_CONN_USER_BLOCKED, CNLive_DISCONN_KICK, CNLive_CLIENT_NOT_INIT, CNLive_INVALID_PARAMETER, CNLive_INVALID_ARGUMENT
  22 + */
  23 +typedef NS_ENUM(NSInteger, CNLiveChatConnectErrorCode) {
  24 +
  25 + /*!
  26 + 连接已被释放
  27 +
  28 + @discussion 建立连接的临时错误码,SDK会做好自动重连,开发者无须处理。
  29 + */
  30 + CNLive_NET_CHANNEL_INVALID = 30001,
  31 +
  32 + /*!
  33 + 连接不可用
  34 +
  35 + @discussion 建立连接的临时错误码,SDK会做好自动重连,开发者无须处理。
  36 + */
  37 + CNLive_NET_UNAVAILABLE = 30002,
  38 +
  39 + /*!
  40 + 导航HTTP发送失败
  41 +
  42 + @discussion 建立连接的临时错误码,SDK会做好自动重连,开发者无须处理。
  43 + */
  44 + CNLive_NAVI_REQUEST_FAIL = 30004,
  45 +
  46 + /*!
  47 + 导航HTTP请求失败
  48 +
  49 + @discussion 建立连接的临时错误码,SDK会做好自动重连,开发者无须处理。
  50 + */
  51 + CNLive_NAVI_RESPONSE_ERROR = 30007,
  52 +
  53 + /*!
  54 + 导航HTTP返回数据格式错误
  55 +
  56 + @discussion 建立连接的临时错误码,SDK会做好自动重连,开发者无须处理。
  57 + */
  58 + CNLive_NODE_NOT_FOUND = 30008,
  59 +
  60 + /*!
  61 + 创建Socket连接失败
  62 +
  63 + @discussion 建立连接的临时错误码,SDK会做好自动重连,开发者无须处理。
  64 + */
  65 + CNLive_SOCKET_NOT_CONNECTED = 30010,
  66 +
  67 + /*!
  68 + Socket断开
  69 +
  70 + @discussion 建立连接的临时错误码,SDK会做好自动重连,开发者无须处理。
  71 + */
  72 + CNLive_SOCKET_DISCONNECTED = 30011,
  73 +
  74 + /*!
  75 + PING失败
  76 +
  77 + @discussion 建立连接的临时错误码,SDK会做好自动重连,开发者无须处理。
  78 + */
  79 + CNLive_PING_SEND_FAIL = 30012,
  80 +
  81 + /*!
  82 + PING超时
  83 +
  84 + @discussion 建立连接的临时错误码,SDK会做好自动重连,开发者无须处理。
  85 + */
  86 + CNLive_PONG_RECV_FAIL = 30013,
  87 +
  88 + /*!
  89 + 信令发送失败
  90 +
  91 + @discussion 建立连接的临时错误码,SDK会做好自动重连,开发者无须处理。
  92 + */
  93 + CNLive_MSG_SEND_FAIL = 30014,
  94 +
  95 + /*!
  96 + 连接过于频繁
  97 +
  98 + @discussion 建立连接的临时错误码,SDK会做好自动重连,开发者无须处理。
  99 + */
  100 + CNLive_CONN_OVERFREQUENCY = 30015,
  101 +
  102 + /*!
  103 + 连接ACK超时
  104 +
  105 + @discussion 建立连接的临时错误码,SDK会做好自动重连,开发者无须处理。
  106 + */
  107 + CNLive_CONN_ACK_TIMEOUT = 31000,
  108 +
  109 + /*!
  110 + 信令版本错误
  111 +
  112 + @discussion 建立连接的临时错误码,SDK会做好自动重连,开发者无须处理。
  113 + */
  114 + CNLive_CONN_PROTO_VERSION_ERROR = 31001,
  115 +
  116 + /*!
  117 + AppKey错误
  118 +
  119 + @discussion 请检查您使用的AppKey是否正确。(*自行处理)
  120 + */
  121 + CNLive_CONN_ID_REJECT = 31002,
  122 +
  123 + /*!
  124 + 服务器当前不可用(预留)
  125 +
  126 + @discussion 建立连接的临时错误码,SDK会做好自动重连,开发者无须处理。
  127 + */
  128 + CNLive_CONN_SERVER_UNAVAILABLE = 31003,
  129 +
  130 + /*!
  131 + Token无效
  132 +
  133 + @discussion Token无效一般有以下两种原因。(*自行处理)
  134 + 一是token错误,请您检查客户端初始化使用的AppKey和您服务器获取token使用的AppKey是否一致;
  135 + 二是token过期,是因为您在开发者后台设置了token过期时间,您需要请求您的服务器重新获取token并再次用新的token建立连接。
  136 + */
  137 + CNLive_CONN_TOKEN_INCORRECT = 31004,
  138 +
  139 + /*!
  140 + AppKey与Token不匹配
  141 +
  142 + @discussion
  143 + 请检查您使用的AppKey与Token是否正确,是否匹配。一般有以下两种原因。(*自行处理)
  144 + 一是token错误,请您检查客户端初始化使用的AppKey和您服务器获取token使用的AppKey是否一致;
  145 + 二是token过期,是因为您在开发者后台设置了token过期时间,您需要请求您的服务器重新获取token并再次用新的token建立连接。
  146 + */
  147 + CNLive_CONN_NOT_AUTHRORIZED = 31005,
  148 +
  149 + /*!
  150 + 连接重定向
  151 +
  152 + @discussion 建立连接的临时错误码,SDK会做好自动重连,开发者无须处理。
  153 + */
  154 + CNLive_CONN_REDIRECTED = 31006,
  155 +
  156 + /*!
  157 + BundleID不正确
  158 +
  159 + @discussion 请检查您App的BundleID是否正确。(*自行处理)
  160 + */
  161 + CNLive_CONN_PACKAGE_NAME_INVALID = 31007,
  162 +
  163 + /*!
  164 + AppKey被封禁或已删除
  165 +
  166 + @discussion 请检查您使用的AppKey是否正确。(*自行处理)
  167 + */
  168 + CNLive_CONN_APP_BLOCKED_OR_DELETED = 31008,
  169 +
  170 + /*!
  171 + 用户被封禁
  172 +
  173 + @discussion 请检查您使用的Token是否正确,以及对应的UserId是否被封禁。(*自行处理)
  174 + */
  175 + CNLive_CONN_USER_BLOCKED = 31009,
  176 +
  177 + /*!
  178 + Token请求失败
  179 +
  180 + @discussion 请检查连接服务器方法的参数是否正确,特别是用户信息中的用户ID。也可能是无网络。(*自行处理)
  181 + */
  182 + CNLive_CONN_TOKEN_NULL = 31012,
  183 +
  184 + /*!
  185 + 当前用户在其他设备上登陆,此设备被踢下线。(*自行处理)
  186 + */
  187 + CNLive_DISCONN_KICK = 31010,
  188 +
  189 + /*!
  190 + SDK没有初始化
  191 +
  192 + @discussion 在使用SDK任何功能之前,必须先Init。(*自行处理)
  193 + */
  194 + CNLive_CONN_CLIENT_NOT_INIT = 33001,
  195 +
  196 + /*!
  197 + 开发者接口调用时传入的参数错误
  198 +
  199 + @discussion 请检查接口调用时传入的参数类型和值。(*自行处理)
  200 + */
  201 + CNLive_CONN_INVALID_PARAMETER = 33003,
  202 +
  203 + /*!
  204 + Connection已经存在
  205 +
  206 + @discussion
  207 + 调用过connect之后,建议在token错误或者被踢下线或者用户logout的情况下才需要再次调用connect。SDK会自动重连,不需要应用多次调用connect来保证连接性。(*自行处理)
  208 + */
  209 + CNLive_CONNECTION_EXIST = 34001,
  210 +
  211 + /*!
  212 + Connection正在连接
  213 +
  214 + @discussion
  215 + Connection正在连接,此时不能再次做connect操作,稍后再做操作(*自行处理)
  216 + */
  217 + CNLive_CONNECTION_CONNING = 34002,
  218 +
  219 + /*!
  220 + 开发者接口调用时传入的参数错误
  221 +
  222 + @discussion 请检查接口调用时传入的参数类型和值。(*自行处理)
  223 + */
  224 + CNLive_INVALID_ARGUMENT = -1000
  225 +};
  226 +
  227 +#pragma mark CNLiveChatErrorCode - 具体业务错误码
  228 +/*!
  229 + 具体业务错误码
  230 + */
  231 +typedef NS_ENUM(NSInteger, CNLiveChatErrorCode) {
  232 + /*!
  233 + 未知错误(预留)
  234 + */
  235 + CNLive_ERRORCODE_UNKNOWN = -1,
  236 +
  237 + /*!
  238 + token错误
  239 + */
  240 + CNLive_ERRORCODE_BY_TOKENERROR = 302,
  241 +
  242 + /*!
  243 + 鉴权失败 此AppId无权加入此targetId的聊天室
  244 + */
  245 + CNLive_ERRORCODE_BY_AUTHENTICATIONERROR = 303,
  246 +
  247 + /*!
  248 + 已被对方加入黑名单
  249 + */
  250 + CNLive_REJECTED_BY_BLACKLIST = 405,
  251 +
  252 + /*!
  253 + 超时
  254 + */
  255 + CNLive_ERRORCODE_TIMEOUT = 5004,
  256 +
  257 + /*!
  258 + 发送消息频率过高,1秒钟最多只允许发送5条消息
  259 + */
  260 + CNLive_SEND_MSG_FREQUENCY_OVERRUN = 20604,
  261 +
  262 + /*!
  263 + 不在该聊天室中
  264 + */
  265 + CNLive_NOT_IN_CHATROOM = 23406,
  266 +
  267 + /*!
  268 + 在该聊天室中已被禁言
  269 + */
  270 + CNLive_FORBIDDEN_IN_CHATROOM = 23408,
  271 +
  272 + /*!
  273 + 已被踢出聊天室
  274 + */
  275 + CNLive_KICKED_FROM_CHATROOM = 23409,
  276 +
  277 + /*!
  278 + 聊天室不存在
  279 + */
  280 + CNLive_CHATROOM_NOT_EXIST = 23410,
  281 +
  282 + /*!
  283 + 聊天室成员超限
  284 + */
  285 + CNLive_CHATROOM_IS_FULL = 23411,
  286 +
  287 + /*!
  288 + 聊天室接口参数无效
  289 + */
  290 + CNLive_PARAMETER_INVALID_CHATROOM = 23412,
  291 +
  292 + /*!
  293 + 聊天室云存储业务未开通
  294 + */
  295 + CNLive_ROAMING_SERVICE_UNAVAILABLE_CHATROOM = 23414,
  296 +
  297 + /*!
  298 + 当前连接不可用(连接已经被释放)
  299 + */
  300 + CNLive_CHANNEL_INVALID = 30001,
  301 +
  302 + /*!
  303 + 当前连接不可用
  304 + */
  305 + CNLive_NETWORK_UNAVAILABLE = 30002,
  306 +
  307 + /*!
  308 + 消息响应超时
  309 + */
  310 + CNLive_MSG_RESPONSE_TIMEOUT = 30003,
  311 +
  312 + /*!
  313 + SDK没有初始化
  314 +
  315 + @discussion 在使用SDK任何功能之前,必须先Init。
  316 + */
  317 + CNLive_CLIENT_NOT_INIT = 33001,
  318 +
  319 + /*!
  320 + 数据库错误
  321 +
  322 + @discussion 请检查您使用的Token和userId是否正确。
  323 + */
  324 + CNLive_DATABASE_ERROR = 33002,
  325 +
  326 + /*!
  327 + 开发者接口调用时传入的参数错误
  328 +
  329 + @discussion 请检查接口调用时传入的参数类型和值。
  330 + */
  331 + CNLive_INVALID_PARAMETER = 33003,
  332 +
  333 + /*!
  334 + 历史消息云存储业务未开通
  335 + */
  336 + CNLive_MSG_ROAMING_SERVICE_UNAVAILABLE = 33007,
  337 +
  338 + /*!
  339 + 消息大小超限,消息体(序列化成json格式之后的内容)最大128k bytes。
  340 + */
  341 + CNLive_MSG_SIZE_OUT_OF_LIMIT = 30016
  342 +};
  343 +
  344 +#pragma mark - 会话相关
  345 +
  346 +#pragma mark CNLiveConversationType - 会话类型
  347 +/*!
  348 + 会话类型
  349 + */
  350 +typedef NS_ENUM(NSUInteger, CNLiveConversationType) {
  351 + /*!
  352 + 私聊
  353 + */
  354 + CNLive_ConversationType_PRIVATE = 1,
  355 +
  356 + /*!
  357 + 聊天室
  358 + */
  359 + CNLive_ConversationType_CHATROOM = 4,
  360 +};
  361 +
  362 +#pragma mark - 线上状态
  363 +
  364 +#pragma mark CNLiveConnectionStatus - 网络连接状态码
  365 +/*!
  366 + 网络连接状态码
  367 +
  368 + @discussion 开发者仅需要关注以下几种连接状态,其余状态SDK均会进行自动重连。
  369 + CNLive_ConnectionStatus_Connected, CNLive_ConnectionStatus_Connecting,
  370 + CNLive_ConnectionStatus_Unconnected,
  371 + CNLive_ConnectionStatus_SignUp, CNLive_ConnectionStatus_KICKED_OFFLINE_BY_OTHER_CLIENT,
  372 + CNLive_ConnectionStatus_TOKEN_INCORRECT
  373 + */
  374 +typedef NS_ENUM(NSInteger, CNLiveConnectionStatus) {
  375 + /*!
  376 + 未知状态
  377 +
  378 + @discussion 建立连接中出现异常的临时状态,SDK会做好自动重连,开发者无须处理。
  379 + */
  380 + CNLive_ConnectionStatus_UNKNOWN = -1,
  381 +
  382 + /*!
  383 + 连接成功
  384 + */
  385 + CNLive_ConnectionStatus_Connected = 0,
  386 +
  387 + /*!
  388 + 当前设备网络不可用
  389 +
  390 + @discussion 建立连接的临时状态,SDK会做好自动重连,开发者无须处理。
  391 + */
  392 + CNLive_ConnectionStatus_NETWORK_UNAVAILABLE = 1,
  393 +
  394 + /*!
  395 + 当前设备切换到飞行模式
  396 +
  397 + @discussion 建立连接的临时状态,SDK会做好自动重连,开发者无须处理。
  398 + */
  399 + CNLive_ConnectionStatus_AIRPLANE_MODE = 2,
  400 +
  401 + /*!
  402 + 当前设备切换到 2G(GPRS、EDGE)低速网络
  403 +
  404 + @discussion 建立连接的临时状态,SDK会做好自动重连,开发者无须处理。
  405 + */
  406 + CNLive_ConnectionStatus_Cellular_2G = 3,
  407 +
  408 + /*!
  409 + 当前设备切换到 3G 或 4G 高速网络
  410 +
  411 + @discussion 建立连接的临时状态,SDK会做好自动重连,开发者无须处理。
  412 + */
  413 + CNLive_ConnectionStatus_Cellular_3G_4G = 4,
  414 +
  415 + /*!
  416 + 当前设备切换到 WIFI 网络
  417 +
  418 + @discussion 建立连接的临时状态,SDK会做好自动重连,开发者无须处理。
  419 + */
  420 + CNLive_ConnectionStatus_WIFI = 5,
  421 +
  422 + /*!
  423 + 当前用户在其他设备上登录,此设备被踢下线
  424 + */
  425 + CNLive_ConnectionStatus_KICKED_OFFLINE_BY_OTHER_CLIENT = 6,
  426 +
  427 + /*!
  428 + 当前用户在 Web 端登录
  429 +
  430 + @discussion 建立连接的临时状态,SDK会做好自动重连,开发者无须处理。
  431 + */
  432 + CNLive_ConnectionStatus_LOGIN_ON_WEB = 7,
  433 +
  434 + /*!
  435 + 服务器异常
  436 +
  437 + @discussion 建立连接的临时状态,SDK会做好自动重连,开发者无须处理。
  438 + */
  439 + CNLive_ConnectionStatus_SERVER_INVALID = 8,
  440 +
  441 + /*!
  442 + 连接验证异常
  443 +
  444 + @discussion 建立连接的临时状态,SDK会做好自动重连,开发者无须处理。
  445 + */
  446 + CNLive_ConnectionStatus_VALIDATE_INVALID = 9,
  447 +
  448 + /*!
  449 + 连接中
  450 + */
  451 + CNLive_ConnectionStatus_Connecting = 10,
  452 +
  453 + /*!
  454 + 连接失败或未连接
  455 + */
  456 + CNLive_ConnectionStatus_Unconnected = 11,
  457 +
  458 + /*!
  459 + 已注销
  460 + */
  461 + CNLive_ConnectionStatus_SignUp = 12,
  462 +
  463 + /*!
  464 + Token无效
  465 +
  466 + @discussion
  467 + Token无效一般有两种原因。一是token错误,请您检查客户端初始化使用的AppKey和您服务器获取token使用的AppKey是否一致;二是token过期,是因为您在开发者后台设置了token过期时间,您需要请求您的服务器重新获取token并再次用新的token建立连接。
  468 + */
  469 + CNLive_ConnectionStatus_TOKEN_INCORRECT = 31004,
  470 +
  471 + /*!
  472 + 与服务器的连接已断开
  473 +
  474 + @discussion 建立连接的临时状态,SDK会做好自动重连,开发者无须处理。
  475 + */
  476 + CNLive_ConnectionStatus_DISCONN_EXCEPTION = 31011,
  477 +
  478 + /*!
  479 + 与服务器的连接已断开
  480 +
  481 + @discussion 无法自动重连,需手动重新连接服务器connectServerSuccess:error:。
  482 + */
  483 + CNLive_ConnectionStatus_DISCONN_MANUALCONN = 32011
  484 +};
  485 +
  486 +
CNLiveChatSDKDemo/CNLiveChatManager.framework/Headers/CNLiveChatUserInfo.h 0 → 100644
  1 +//
  2 +// CNLiveChatUserInfo.h
  3 +// CNLiveChatManager
  4 +//
  5 +// Created by cnliveJunBo on 17/3/1.
  6 +// Copyright © 2017年 cnlive. All rights reserved.
  7 +//
  8 +
  9 +#import <Foundation/Foundation.h>
  10 +
  11 +@interface CNLiveChatUserInfo : NSObject
  12 +
  13 +/*!
  14 + 用户ID(一旦以一个用户ID连接到服务器,就不能再修改用户ID了,如果修改也会被忽略)
  15 + */
  16 +@property(nonatomic, strong) NSString *userId;
  17 +
  18 +/*!
  19 + 用户名称
  20 + */
  21 +@property(nonatomic, strong) NSString *name;
  22 +
  23 +/*!
  24 + 用户头像的URL
  25 + */
  26 +@property(nonatomic, strong) NSString *portraitUri;
  27 +
  28 +/*!
  29 + 用户信息的初始化方法
  30 +
  31 + @param userId 用户ID
  32 + @param username 用户名称
  33 + @param portrait 用户头像的URL
  34 + @return 用户信息对象
  35 + */
  36 +- (instancetype)initWithUserId:(NSString *)userId
  37 + name:(NSString *)username
  38 + portrait:(NSString *)portrait;
  39 +
  40 +@end
CNLiveChatSDKDemo/CNLiveChatManager.framework/Info.plist 0 → 100644
No preview for this file type
CNLiveChatSDKDemo/CNLiveChatSDKDemo.xcodeproj/project.pbxproj 0 → 100644
  1 +// !$*UTF8*$!
  2 +{
  3 + archiveVersion = 1;
  4 + classes = {
  5 + };
  6 + objectVersion = 46;
  7 + objects = {
  8 +
  9 +/* Begin PBXBuildFile section */
  10 + D22D32971E754A17004453ED /* CNLiveMsgTools.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D29C035C1E7549DE00EB41A7 /* CNLiveMsgTools.framework */; };
  11 + D22D32981E754A17004453ED /* CNLiveMsgTools.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = D29C035C1E7549DE00EB41A7 /* CNLiveMsgTools.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
  12 + D231941F1E70101500111C3B /* MessageModel.m in Sources */ = {isa = PBXBuildFile; fileRef = D231941E1E70101500111C3B /* MessageModel.m */; };
  13 + D231C8A61E6FFC2700EAC427 /* ChatRoomViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = D231C8A51E6FFC2700EAC427 /* ChatRoomViewController.m */; };
  14 + D231C8A91E6FFD3100EAC427 /* PrivateViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = D231C8A81E6FFD3100EAC427 /* PrivateViewController.m */; };
  15 + D264D5A51E6FDE02002CDF41 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = D264D5A41E6FDE02002CDF41 /* main.m */; };
  16 + D264D5A81E6FDE02002CDF41 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = D264D5A71E6FDE02002CDF41 /* AppDelegate.m */; };
  17 + D264D5AB1E6FDE02002CDF41 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = D264D5AA1E6FDE02002CDF41 /* ViewController.m */; };
  18 + D264D5AE1E6FDE02002CDF41 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = D264D5AC1E6FDE02002CDF41 /* Main.storyboard */; };
  19 + D264D5B01E6FDE02002CDF41 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = D264D5AF1E6FDE02002CDF41 /* Assets.xcassets */; };
  20 + D264D5B31E6FDE02002CDF41 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = D264D5B11E6FDE02002CDF41 /* LaunchScreen.storyboard */; };
  21 + D29C035D1E7549DE00EB41A7 /* CNLiveMsgTools.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D29C035C1E7549DE00EB41A7 /* CNLiveMsgTools.framework */; };
  22 + D2C670AB1E762EE100FDD4CC /* CNLiveChatManager.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D2C670AA1E762EE100FDD4CC /* CNLiveChatManager.framework */; };
  23 + D2C670AC1E762EE500FDD4CC /* CNLiveChatManager.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D2C670AA1E762EE100FDD4CC /* CNLiveChatManager.framework */; };
  24 + D2C670AD1E762EE500FDD4CC /* CNLiveChatManager.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = D2C670AA1E762EE100FDD4CC /* CNLiveChatManager.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
  25 +/* End PBXBuildFile section */
  26 +
  27 +/* Begin PBXCopyFilesBuildPhase section */
  28 + D264D5C11E6FE301002CDF41 /* Embed Frameworks */ = {
  29 + isa = PBXCopyFilesBuildPhase;
  30 + buildActionMask = 2147483647;
  31 + dstPath = "";
  32 + dstSubfolderSpec = 10;
  33 + files = (
  34 + D22D32981E754A17004453ED /* CNLiveMsgTools.framework in Embed Frameworks */,
  35 + D2C670AD1E762EE500FDD4CC /* CNLiveChatManager.framework in Embed Frameworks */,
  36 + );
  37 + name = "Embed Frameworks";
  38 + runOnlyForDeploymentPostprocessing = 0;
  39 + };
  40 +/* End PBXCopyFilesBuildPhase section */
  41 +
  42 +/* Begin PBXFileReference section */
  43 + D231941D1E70101500111C3B /* MessageModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MessageModel.h; sourceTree = "<group>"; };
  44 + D231941E1E70101500111C3B /* MessageModel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MessageModel.m; sourceTree = "<group>"; };
  45 + D231C8A41E6FFC2700EAC427 /* ChatRoomViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ChatRoomViewController.h; sourceTree = "<group>"; };
  46 + D231C8A51E6FFC2700EAC427 /* ChatRoomViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ChatRoomViewController.m; sourceTree = "<group>"; };
  47 + D231C8A71E6FFD3100EAC427 /* PrivateViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PrivateViewController.h; sourceTree = "<group>"; };
  48 + D231C8A81E6FFD3100EAC427 /* PrivateViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PrivateViewController.m; sourceTree = "<group>"; };
  49 + D264D5A01E6FDE02002CDF41 /* CNLiveChatSDKDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = CNLiveChatSDKDemo.app; sourceTree = BUILT_PRODUCTS_DIR; };
  50 + D264D5A41E6FDE02002CDF41 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
  51 + D264D5A61E6FDE02002CDF41 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
  52 + D264D5A71E6FDE02002CDF41 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; };
  53 + D264D5A91E6FDE02002CDF41 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = "<group>"; };
  54 + D264D5AA1E6FDE02002CDF41 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = "<group>"; };
  55 + D264D5AD1E6FDE02002CDF41 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
  56 + D264D5AF1E6FDE02002CDF41 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
  57 + D264D5B21E6FDE02002CDF41 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
  58 + D264D5B41E6FDE02002CDF41 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
  59 + D264D5BE1E6FDEED002CDF41 /* PrefixHeader.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PrefixHeader.pch; sourceTree = "<group>"; };
  60 + D29C035C1E7549DE00EB41A7 /* CNLiveMsgTools.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = CNLiveMsgTools.framework; sourceTree = "<group>"; };
  61 + D2C670AA1E762EE100FDD4CC /* CNLiveChatManager.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = CNLiveChatManager.framework; sourceTree = "<group>"; };
  62 +/* End PBXFileReference section */
  63 +
  64 +/* Begin PBXFrameworksBuildPhase section */
  65 + D264D59D1E6FDE02002CDF41 /* Frameworks */ = {
  66 + isa = PBXFrameworksBuildPhase;
  67 + buildActionMask = 2147483647;
  68 + files = (
  69 + D29C035D1E7549DE00EB41A7 /* CNLiveMsgTools.framework in Frameworks */,
  70 + D22D32971E754A17004453ED /* CNLiveMsgTools.framework in Frameworks */,
  71 + D2C670AB1E762EE100FDD4CC /* CNLiveChatManager.framework in Frameworks */,
  72 + D2C670AC1E762EE500FDD4CC /* CNLiveChatManager.framework in Frameworks */,
  73 + );
  74 + runOnlyForDeploymentPostprocessing = 0;
  75 + };
  76 +/* End PBXFrameworksBuildPhase section */
  77 +
  78 +/* Begin PBXGroup section */
  79 + D231941C1E700FEC00111C3B /* Controller */ = {
  80 + isa = PBXGroup;
  81 + children = (
  82 + D264D5A91E6FDE02002CDF41 /* ViewController.h */,
  83 + D264D5AA1E6FDE02002CDF41 /* ViewController.m */,
  84 + D231C8A71E6FFD3100EAC427 /* PrivateViewController.h */,
  85 + D231C8A81E6FFD3100EAC427 /* PrivateViewController.m */,
  86 + D231C8A41E6FFC2700EAC427 /* ChatRoomViewController.h */,
  87 + D231C8A51E6FFC2700EAC427 /* ChatRoomViewController.m */,
  88 + );
  89 + name = Controller;
  90 + sourceTree = "<group>";
  91 + };
  92 + D23194201E70101B00111C3B /* Model */ = {
  93 + isa = PBXGroup;
  94 + children = (
  95 + D231941D1E70101500111C3B /* MessageModel.h */,
  96 + D231941E1E70101500111C3B /* MessageModel.m */,
  97 + );
  98 + name = Model;
  99 + sourceTree = "<group>";
  100 + };
  101 + D264D5971E6FDE02002CDF41 = {
  102 + isa = PBXGroup;
  103 + children = (
  104 + D2C670AA1E762EE100FDD4CC /* CNLiveChatManager.framework */,
  105 + D29C035C1E7549DE00EB41A7 /* CNLiveMsgTools.framework */,
  106 + D264D5A21E6FDE02002CDF41 /* CNLiveChatSDKDemo */,
  107 + D264D5A11E6FDE02002CDF41 /* Products */,
  108 + );
  109 + sourceTree = "<group>";
  110 + };
  111 + D264D5A11E6FDE02002CDF41 /* Products */ = {
  112 + isa = PBXGroup;
  113 + children = (
  114 + D264D5A01E6FDE02002CDF41 /* CNLiveChatSDKDemo.app */,
  115 + );
  116 + name = Products;
  117 + sourceTree = "<group>";
  118 + };
  119 + D264D5A21E6FDE02002CDF41 /* CNLiveChatSDKDemo */ = {
  120 + isa = PBXGroup;
  121 + children = (
  122 + D264D5A61E6FDE02002CDF41 /* AppDelegate.h */,
  123 + D264D5A71E6FDE02002CDF41 /* AppDelegate.m */,
  124 + D23194201E70101B00111C3B /* Model */,
  125 + D231941C1E700FEC00111C3B /* Controller */,
  126 + D264D5BE1E6FDEED002CDF41 /* PrefixHeader.pch */,
  127 + D264D5AC1E6FDE02002CDF41 /* Main.storyboard */,
  128 + D264D5AF1E6FDE02002CDF41 /* Assets.xcassets */,
  129 + D264D5B11E6FDE02002CDF41 /* LaunchScreen.storyboard */,
  130 + D264D5B41E6FDE02002CDF41 /* Info.plist */,
  131 + D264D5A31E6FDE02002CDF41 /* Supporting Files */,
  132 + );
  133 + path = CNLiveChatSDKDemo;
  134 + sourceTree = "<group>";
  135 + };
  136 + D264D5A31E6FDE02002CDF41 /* Supporting Files */ = {
  137 + isa = PBXGroup;
  138 + children = (
  139 + D264D5A41E6FDE02002CDF41 /* main.m */,
  140 + );
  141 + name = "Supporting Files";
  142 + sourceTree = "<group>";
  143 + };
  144 +/* End PBXGroup section */
  145 +
  146 +/* Begin PBXNativeTarget section */
  147 + D264D59F1E6FDE02002CDF41 /* CNLiveChatSDKDemo */ = {
  148 + isa = PBXNativeTarget;
  149 + buildConfigurationList = D264D5B71E6FDE02002CDF41 /* Build configuration list for PBXNativeTarget "CNLiveChatSDKDemo" */;
  150 + buildPhases = (
  151 + D264D59C1E6FDE02002CDF41 /* Sources */,
  152 + D264D59D1E6FDE02002CDF41 /* Frameworks */,
  153 + D264D59E1E6FDE02002CDF41 /* Resources */,
  154 + D264D5C11E6FE301002CDF41 /* Embed Frameworks */,
  155 + );
  156 + buildRules = (
  157 + );
  158 + dependencies = (
  159 + );
  160 + name = CNLiveChatSDKDemo;
  161 + productName = CNLiveChatSDKDemo;
  162 + productReference = D264D5A01E6FDE02002CDF41 /* CNLiveChatSDKDemo.app */;
  163 + productType = "com.apple.product-type.application";
  164 + };
  165 +/* End PBXNativeTarget section */
  166 +
  167 +/* Begin PBXProject section */
  168 + D264D5981E6FDE02002CDF41 /* Project object */ = {
  169 + isa = PBXProject;
  170 + attributes = {
  171 + LastUpgradeCheck = 0800;
  172 + ORGANIZATIONNAME = cnlive;
  173 + TargetAttributes = {
  174 + D264D59F1E6FDE02002CDF41 = {
  175 + CreatedOnToolsVersion = 8.0;
  176 + DevelopmentTeam = 94X49GG3ZW;
  177 + ProvisioningStyle = Automatic;
  178 + };
  179 + };
  180 + };
  181 + buildConfigurationList = D264D59B1E6FDE02002CDF41 /* Build configuration list for PBXProject "CNLiveChatSDKDemo" */;
  182 + compatibilityVersion = "Xcode 3.2";
  183 + developmentRegion = English;
  184 + hasScannedForEncodings = 0;
  185 + knownRegions = (
  186 + en,
  187 + Base,
  188 + );
  189 + mainGroup = D264D5971E6FDE02002CDF41;
  190 + productRefGroup = D264D5A11E6FDE02002CDF41 /* Products */;
  191 + projectDirPath = "";
  192 + projectRoot = "";
  193 + targets = (
  194 + D264D59F1E6FDE02002CDF41 /* CNLiveChatSDKDemo */,
  195 + );
  196 + };
  197 +/* End PBXProject section */
  198 +
  199 +/* Begin PBXResourcesBuildPhase section */
  200 + D264D59E1E6FDE02002CDF41 /* Resources */ = {
  201 + isa = PBXResourcesBuildPhase;
  202 + buildActionMask = 2147483647;
  203 + files = (
  204 + D264D5B31E6FDE02002CDF41 /* LaunchScreen.storyboard in Resources */,
  205 + D264D5B01E6FDE02002CDF41 /* Assets.xcassets in Resources */,
  206 + D264D5AE1E6FDE02002CDF41 /* Main.storyboard in Resources */,
  207 + );
  208 + runOnlyForDeploymentPostprocessing = 0;
  209 + };
  210 +/* End PBXResourcesBuildPhase section */
  211 +
  212 +/* Begin PBXSourcesBuildPhase section */
  213 + D264D59C1E6FDE02002CDF41 /* Sources */ = {
  214 + isa = PBXSourcesBuildPhase;
  215 + buildActionMask = 2147483647;
  216 + files = (
  217 + D264D5AB1E6FDE02002CDF41 /* ViewController.m in Sources */,
  218 + D264D5A81E6FDE02002CDF41 /* AppDelegate.m in Sources */,
  219 + D231C8A91E6FFD3100EAC427 /* PrivateViewController.m in Sources */,
  220 + D264D5A51E6FDE02002CDF41 /* main.m in Sources */,
  221 + D231C8A61E6FFC2700EAC427 /* ChatRoomViewController.m in Sources */,
  222 + D231941F1E70101500111C3B /* MessageModel.m in Sources */,
  223 + );
  224 + runOnlyForDeploymentPostprocessing = 0;
  225 + };
  226 +/* End PBXSourcesBuildPhase section */
  227 +
  228 +/* Begin PBXVariantGroup section */
  229 + D264D5AC1E6FDE02002CDF41 /* Main.storyboard */ = {
  230 + isa = PBXVariantGroup;
  231 + children = (
  232 + D264D5AD1E6FDE02002CDF41 /* Base */,
  233 + );
  234 + name = Main.storyboard;
  235 + sourceTree = "<group>";
  236 + };
  237 + D264D5B11E6FDE02002CDF41 /* LaunchScreen.storyboard */ = {
  238 + isa = PBXVariantGroup;
  239 + children = (
  240 + D264D5B21E6FDE02002CDF41 /* Base */,
  241 + );
  242 + name = LaunchScreen.storyboard;
  243 + sourceTree = "<group>";
  244 + };
  245 +/* End PBXVariantGroup section */
  246 +
  247 +/* Begin XCBuildConfiguration section */
  248 + D264D5B51E6FDE02002CDF41 /* Debug */ = {
  249 + isa = XCBuildConfiguration;
  250 + buildSettings = {
  251 + ALWAYS_SEARCH_USER_PATHS = NO;
  252 + CLANG_ANALYZER_NONNULL = YES;
  253 + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
  254 + CLANG_CXX_LIBRARY = "libc++";
  255 + CLANG_ENABLE_MODULES = YES;
  256 + CLANG_ENABLE_OBJC_ARC = YES;
  257 + CLANG_WARN_BOOL_CONVERSION = YES;
  258 + CLANG_WARN_CONSTANT_CONVERSION = YES;
  259 + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
  260 + CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
  261 + CLANG_WARN_EMPTY_BODY = YES;
  262 + CLANG_WARN_ENUM_CONVERSION = YES;
  263 + CLANG_WARN_INFINITE_RECURSION = YES;
  264 + CLANG_WARN_INT_CONVERSION = YES;
  265 + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
  266 + CLANG_WARN_SUSPICIOUS_MOVES = YES;
  267 + CLANG_WARN_UNREACHABLE_CODE = YES;
  268 + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
  269 + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
  270 + COPY_PHASE_STRIP = NO;
  271 + DEBUG_INFORMATION_FORMAT = dwarf;
  272 + ENABLE_STRICT_OBJC_MSGSEND = YES;
  273 + ENABLE_TESTABILITY = YES;
  274 + GCC_C_LANGUAGE_STANDARD = gnu99;
  275 + GCC_DYNAMIC_NO_PIC = NO;
  276 + GCC_NO_COMMON_BLOCKS = YES;
  277 + GCC_OPTIMIZATION_LEVEL = 0;
  278 + GCC_PREPROCESSOR_DEFINITIONS = (
  279 + "DEBUG=1",
  280 + "$(inherited)",
  281 + );
  282 + GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
  283 + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
  284 + GCC_WARN_UNDECLARED_SELECTOR = YES;
  285 + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
  286 + GCC_WARN_UNUSED_FUNCTION = YES;
  287 + GCC_WARN_UNUSED_VARIABLE = YES;
  288 + IPHONEOS_DEPLOYMENT_TARGET = 10.0;
  289 + MTL_ENABLE_DEBUG_INFO = YES;
  290 + ONLY_ACTIVE_ARCH = YES;
  291 + SDKROOT = iphoneos;
  292 + TARGETED_DEVICE_FAMILY = "1,2";
  293 + };
  294 + name = Debug;
  295 + };
  296 + D264D5B61E6FDE02002CDF41 /* Release */ = {
  297 + isa = XCBuildConfiguration;
  298 + buildSettings = {
  299 + ALWAYS_SEARCH_USER_PATHS = NO;
  300 + CLANG_ANALYZER_NONNULL = YES;
  301 + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
  302 + CLANG_CXX_LIBRARY = "libc++";
  303 + CLANG_ENABLE_MODULES = YES;
  304 + CLANG_ENABLE_OBJC_ARC = YES;
  305 + CLANG_WARN_BOOL_CONVERSION = YES;
  306 + CLANG_WARN_CONSTANT_CONVERSION = YES;
  307 + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
  308 + CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
  309 + CLANG_WARN_EMPTY_BODY = YES;
  310 + CLANG_WARN_ENUM_CONVERSION = YES;
  311 + CLANG_WARN_INFINITE_RECURSION = YES;
  312 + CLANG_WARN_INT_CONVERSION = YES;
  313 + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
  314 + CLANG_WARN_SUSPICIOUS_MOVES = YES;
  315 + CLANG_WARN_UNREACHABLE_CODE = YES;
  316 + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
  317 + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
  318 + COPY_PHASE_STRIP = NO;
  319 + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
  320 + ENABLE_NS_ASSERTIONS = NO;
  321 + ENABLE_STRICT_OBJC_MSGSEND = YES;
  322 + GCC_C_LANGUAGE_STANDARD = gnu99;
  323 + GCC_NO_COMMON_BLOCKS = YES;
  324 + GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
  325 + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
  326 + GCC_WARN_UNDECLARED_SELECTOR = YES;
  327 + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
  328 + GCC_WARN_UNUSED_FUNCTION = YES;
  329 + GCC_WARN_UNUSED_VARIABLE = YES;
  330 + IPHONEOS_DEPLOYMENT_TARGET = 10.0;
  331 + MTL_ENABLE_DEBUG_INFO = NO;
  332 + SDKROOT = iphoneos;
  333 + TARGETED_DEVICE_FAMILY = "1,2";
  334 + VALIDATE_PRODUCT = YES;
  335 + };
  336 + name = Release;
  337 + };
  338 + D264D5B81E6FDE02002CDF41 /* Debug */ = {
  339 + isa = XCBuildConfiguration;
  340 + buildSettings = {
  341 + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
  342 + DEVELOPMENT_TEAM = 94X49GG3ZW;
  343 + FRAMEWORK_SEARCH_PATHS = (
  344 + "$(inherited)",
  345 + "$(PROJECT_DIR)",
  346 + );
  347 + GCC_PREFIX_HEADER = "$(SRCROOT)/CNLiveChatSDKDemo/PrefixHeader.pch";
  348 + INFOPLIST_FILE = CNLiveChatSDKDemo/Info.plist;
  349 + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
  350 + PRODUCT_BUNDLE_IDENTIFIER = com.cnlive.libs.CNLiveChatSDKDemo;
  351 + PRODUCT_NAME = "$(TARGET_NAME)";
  352 + };
  353 + name = Debug;
  354 + };
  355 + D264D5B91E6FDE02002CDF41 /* Release */ = {
  356 + isa = XCBuildConfiguration;
  357 + buildSettings = {
  358 + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
  359 + DEVELOPMENT_TEAM = 94X49GG3ZW;
  360 + FRAMEWORK_SEARCH_PATHS = (
  361 + "$(inherited)",
  362 + "$(PROJECT_DIR)",
  363 + );
  364 + GCC_PREFIX_HEADER = "$(SRCROOT)/CNLiveChatSDKDemo/PrefixHeader.pch";
  365 + INFOPLIST_FILE = CNLiveChatSDKDemo/Info.plist;
  366 + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
  367 + PRODUCT_BUNDLE_IDENTIFIER = com.cnlive.libs.CNLiveChatSDKDemo;
  368 + PRODUCT_NAME = "$(TARGET_NAME)";
  369 + };
  370 + name = Release;
  371 + };
  372 +/* End XCBuildConfiguration section */
  373 +
  374 +/* Begin XCConfigurationList section */
  375 + D264D59B1E6FDE02002CDF41 /* Build configuration list for PBXProject "CNLiveChatSDKDemo" */ = {
  376 + isa = XCConfigurationList;
  377 + buildConfigurations = (
  378 + D264D5B51E6FDE02002CDF41 /* Debug */,
  379 + D264D5B61E6FDE02002CDF41 /* Release */,
  380 + );
  381 + defaultConfigurationIsVisible = 0;
  382 + defaultConfigurationName = Release;
  383 + };
  384 + D264D5B71E6FDE02002CDF41 /* Build configuration list for PBXNativeTarget "CNLiveChatSDKDemo" */ = {
  385 + isa = XCConfigurationList;
  386 + buildConfigurations = (
  387 + D264D5B81E6FDE02002CDF41 /* Debug */,
  388 + D264D5B91E6FDE02002CDF41 /* Release */,
  389 + );
  390 + defaultConfigurationIsVisible = 0;
  391 + defaultConfigurationName = Release;
  392 + };
  393 +/* End XCConfigurationList section */
  394 + };
  395 + rootObject = D264D5981E6FDE02002CDF41 /* Project object */;
  396 +}
CNLiveChatSDKDemo/CNLiveChatSDKDemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata 0 → 100644
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<Workspace
  3 + version = "1.0">
  4 + <FileRef
  5 + location = "self:CNLiveChatSDKDemo.xcodeproj">
  6 + </FileRef>
  7 +</Workspace>
CNLiveChatSDKDemo/CNLiveChatSDKDemo.xcodeproj/xcuserdata/cnlive.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist 0 → 100644
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<Bucket
  3 + type = "1"
  4 + version = "2.0">
  5 +</Bucket>
CNLiveChatSDKDemo/CNLiveChatSDKDemo.xcodeproj/xcuserdata/cnlive.xcuserdatad/xcschemes/CNLiveChatSDKDemo.xcscheme 0 → 100644
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<Scheme
  3 + LastUpgradeVersion = "0800"
  4 + version = "1.3">
  5 + <BuildAction
  6 + parallelizeBuildables = "YES"
  7 + buildImplicitDependencies = "YES">
  8 + <BuildActionEntries>
  9 + <BuildActionEntry
  10 + buildForTesting = "YES"
  11 + buildForRunning = "YES"
  12 + buildForProfiling = "YES"
  13 + buildForArchiving = "YES"
  14 + buildForAnalyzing = "YES">
  15 + <BuildableReference
  16 + BuildableIdentifier = "primary"
  17 + BlueprintIdentifier = "D264D59F1E6FDE02002CDF41"
  18 + BuildableName = "CNLiveChatSDKDemo.app"
  19 + BlueprintName = "CNLiveChatSDKDemo"
  20 + ReferencedContainer = "container:CNLiveChatSDKDemo.xcodeproj">
  21 + </BuildableReference>
  22 + </BuildActionEntry>
  23 + </BuildActionEntries>
  24 + </BuildAction>
  25 + <TestAction
  26 + buildConfiguration = "Debug"
  27 + selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
  28 + selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
  29 + shouldUseLaunchSchemeArgsEnv = "YES">
  30 + <Testables>
  31 + </Testables>
  32 + <MacroExpansion>
  33 + <BuildableReference
  34 + BuildableIdentifier = "primary"
  35 + BlueprintIdentifier = "D264D59F1E6FDE02002CDF41"
  36 + BuildableName = "CNLiveChatSDKDemo.app"
  37 + BlueprintName = "CNLiveChatSDKDemo"
  38 + ReferencedContainer = "container:CNLiveChatSDKDemo.xcodeproj">
  39 + </BuildableReference>
  40 + </MacroExpansion>
  41 + <AdditionalOptions>
  42 + </AdditionalOptions>
  43 + </TestAction>
  44 + <LaunchAction
  45 + buildConfiguration = "Debug"
  46 + selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
  47 + selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
  48 + launchStyle = "0"
  49 + useCustomWorkingDirectory = "NO"
  50 + ignoresPersistentStateOnLaunch = "NO"
  51 + debugDocumentVersioning = "YES"
  52 + debugServiceExtension = "internal"
  53 + allowLocationSimulation = "YES">
  54 + <BuildableProductRunnable
  55 + runnableDebuggingMode = "0">
  56 + <BuildableReference
  57 + BuildableIdentifier = "primary"
  58 + BlueprintIdentifier = "D264D59F1E6FDE02002CDF41"
  59 + BuildableName = "CNLiveChatSDKDemo.app"
  60 + BlueprintName = "CNLiveChatSDKDemo"
  61 + ReferencedContainer = "container:CNLiveChatSDKDemo.xcodeproj">
  62 + </BuildableReference>
  63 + </BuildableProductRunnable>
  64 + <AdditionalOptions>
  65 + </AdditionalOptions>
  66 + </LaunchAction>
  67 + <ProfileAction
  68 + buildConfiguration = "Release"
  69 + shouldUseLaunchSchemeArgsEnv = "YES"
  70 + savedToolIdentifier = ""
  71 + useCustomWorkingDirectory = "NO"
  72 + debugDocumentVersioning = "YES">
  73 + <BuildableProductRunnable
  74 + runnableDebuggingMode = "0">
  75 + <BuildableReference
  76 + BuildableIdentifier = "primary"
  77 + BlueprintIdentifier = "D264D59F1E6FDE02002CDF41"
  78 + BuildableName = "CNLiveChatSDKDemo.app"
  79 + BlueprintName = "CNLiveChatSDKDemo"
  80 + ReferencedContainer = "container:CNLiveChatSDKDemo.xcodeproj">
  81 + </BuildableReference>
  82 + </BuildableProductRunnable>
  83 + </ProfileAction>
  84 + <AnalyzeAction
  85 + buildConfiguration = "Debug">
  86 + </AnalyzeAction>
  87 + <ArchiveAction
  88 + buildConfiguration = "Release"
  89 + revealArchiveInOrganizer = "YES">
  90 + </ArchiveAction>
  91 +</Scheme>
CNLiveChatSDKDemo/CNLiveChatSDKDemo.xcodeproj/xcuserdata/cnlive.xcuserdatad/xcschemes/xcschememanagement.plist 0 → 100644
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
  3 +<plist version="1.0">
  4 +<dict>
  5 + <key>SchemeUserState</key>
  6 + <dict>
  7 + <key>CNLiveChatSDKDemo.xcscheme</key>
  8 + <dict>
  9 + <key>orderHint</key>
  10 + <integer>0</integer>
  11 + </dict>
  12 + </dict>
  13 + <key>SuppressBuildableAutocreation</key>
  14 + <dict>
  15 + <key>D264D59F1E6FDE02002CDF41</key>
  16 + <dict>
  17 + <key>primary</key>
  18 + <true/>
  19 + </dict>
  20 + </dict>
  21 +</dict>
  22 +</plist>
CNLiveChatSDKDemo/CNLiveChatSDKDemo/AppDelegate.h 0 → 100644
  1 +//
  2 +// AppDelegate.h
  3 +// CNLiveChatSDKDemo
  4 +//
  5 +// Created by cnliveJunBo on 17/3/8.
  6 +// Copyright © 2017年 cnlive. All rights reserved.
  7 +//
  8 +
  9 +#import <UIKit/UIKit.h>
  10 +
  11 +@interface AppDelegate : UIResponder <UIApplicationDelegate>
  12 +
  13 +@property (strong, nonatomic) UIWindow *window;
  14 +
  15 +
  16 +@end
  17 +
CNLiveChatSDKDemo/CNLiveChatSDKDemo/AppDelegate.m 0 → 100644
  1 +//
  2 +// AppDelegate.m
  3 +// CNLiveChatSDKDemo
  4 +//
  5 +// Created by cnliveJunBo on 17/3/8.
  6 +// Copyright © 2017年 cnlive. All rights reserved.
  7 +//
  8 +
  9 +#import "AppDelegate.h"
  10 +#import "ViewController.h"
  11 +
  12 +@interface AppDelegate ()
  13 +
  14 +@end
  15 +
  16 +@implementation AppDelegate
  17 +
  18 +
  19 +- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
  20 +
  21 + // 不要重复初始化
  22 + [[CNLiveChatManager sharedCNLiveChatManager] initWithAppKey:@"69fe70bda67e059286ad509d9f5377f815955645b52f94" appId:@"60_irn9edco29"];
  23 +
  24 + CNLiveChatUserInfo *userInfo = [[CNLiveChatUserInfo alloc] initWithUserId:@"20170312" name:@"20170312" portrait:@""];
  25 +
  26 + [[CNLiveChatManager sharedCNLiveChatManager] loginServer:userInfo success:^(NSString *userId) {
  27 +
  28 + NSLog(@"用户:%@ 已成功登陆",userId);
  29 +
  30 + } error:^(CNLiveChatConnectErrorCode errors) {
  31 +
  32 + NSLog(@"登陆失败,错误码为:%ld",(long)errors);
  33 + }];
  34 +
  35 + self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
  36 + ViewController *vc = [[ViewController alloc] init];
  37 + UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:vc];
  38 + self.window.rootViewController = nav;
  39 + [self.window makeKeyAndVisible];
  40 +
  41 + return YES;
  42 +}
  43 +
  44 +
  45 +- (void)applicationWillResignActive:(UIApplication *)application {
  46 + // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
  47 + // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
  48 +}
  49 +
  50 +
  51 +- (void)applicationDidEnterBackground:(UIApplication *)application {
  52 + // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
  53 + // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
  54 +}
  55 +
  56 +
  57 +- (void)applicationWillEnterForeground:(UIApplication *)application {
  58 + // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
  59 +}
  60 +
  61 +
  62 +- (void)applicationDidBecomeActive:(UIApplication *)application {
  63 + // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
  64 +}
  65 +
  66 +
  67 +- (void)applicationWillTerminate:(UIApplication *)application {
  68 + // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
  69 +}
  70 +
  71 +
  72 +@end
CNLiveChatSDKDemo/CNLiveChatSDKDemo/Assets.xcassets/AppIcon.appiconset/Contents.json 0 → 100644
  1 +{
  2 + "images" : [
  3 + {
  4 + "idiom" : "iphone",
  5 + "size" : "29x29",
  6 + "scale" : "2x"
  7 + },
  8 + {
  9 + "idiom" : "iphone",
  10 + "size" : "29x29",
  11 + "scale" : "3x"
  12 + },
  13 + {
  14 + "idiom" : "iphone",
  15 + "size" : "40x40",
  16 + "scale" : "2x"
  17 + },
  18 + {
  19 + "idiom" : "iphone",
  20 + "size" : "40x40",
  21 + "scale" : "3x"
  22 + },
  23 + {
  24 + "idiom" : "iphone",
  25 + "size" : "60x60",
  26 + "scale" : "2x"
  27 + },
  28 + {
  29 + "idiom" : "iphone",
  30 + "size" : "60x60",
  31 + "scale" : "3x"
  32 + },
  33 + {
  34 + "idiom" : "ipad",
  35 + "size" : "29x29",
  36 + "scale" : "1x"
  37 + },
  38 + {
  39 + "idiom" : "ipad",
  40 + "size" : "29x29",
  41 + "scale" : "2x"
  42 + },
  43 + {
  44 + "idiom" : "ipad",
  45 + "size" : "40x40",
  46 + "scale" : "1x"
  47 + },
  48 + {
  49 + "idiom" : "ipad",
  50 + "size" : "40x40",
  51 + "scale" : "2x"
  52 + },
  53 + {
  54 + "idiom" : "ipad",
  55 + "size" : "76x76",
  56 + "scale" : "1x"
  57 + },
  58 + {
  59 + "idiom" : "ipad",
  60 + "size" : "76x76",
  61 + "scale" : "2x"
  62 + }
  63 + ],
  64 + "info" : {
  65 + "version" : 1,
  66 + "author" : "xcode"
  67 + }
  68 +}
0 \ No newline at end of file 69 \ No newline at end of file
CNLiveChatSDKDemo/CNLiveChatSDKDemo/Base.lproj/LaunchScreen.storyboard 0 → 100644
  1 +<?xml version="1.0" encoding="UTF-8" standalone="no"?>
  2 +<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="11134" systemVersion="15F34" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
  3 + <dependencies>
  4 + <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11106"/>
  5 + <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
  6 + </dependencies>
  7 + <scenes>
  8 + <!--View Controller-->
  9 + <scene sceneID="EHf-IW-A2E">
  10 + <objects>
  11 + <viewController id="01J-lp-oVM" sceneMemberID="viewController">
  12 + <layoutGuides>
  13 + <viewControllerLayoutGuide type="top" id="Llm-lL-Icb"/>
  14 + <viewControllerLayoutGuide type="bottom" id="xb3-aO-Qok"/>
  15 + </layoutGuides>
  16 + <view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
  17 + <rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
  18 + <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
  19 + <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
  20 + </view>
  21 + </viewController>
  22 + <placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
  23 + </objects>
  24 + <point key="canvasLocation" x="53" y="375"/>
  25 + </scene>
  26 + </scenes>
  27 +</document>
CNLiveChatSDKDemo/CNLiveChatSDKDemo/Base.lproj/Main.storyboard 0 → 100644
  1 +<?xml version="1.0" encoding="UTF-8" standalone="no"?>
  2 +<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="11134" systemVersion="15F34" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="BYZ-38-t0r">
  3 + <dependencies>
  4 + <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11106"/>
  5 + <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
  6 + </dependencies>
  7 + <scenes>
  8 + <!--View Controller-->
  9 + <scene sceneID="tne-QT-ifu">
  10 + <objects>
  11 + <viewController id="BYZ-38-t0r" customClass="ViewController" customModuleProvider="" sceneMemberID="viewController">
  12 + <layoutGuides>
  13 + <viewControllerLayoutGuide type="top" id="y3c-jy-aDJ"/>
  14 + <viewControllerLayoutGuide type="bottom" id="wfy-db-euE"/>
  15 + </layoutGuides>
  16 + <view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC">
  17 + <rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
  18 + <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
  19 + <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
  20 + </view>
  21 + </viewController>
  22 + <placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
  23 + </objects>
  24 + </scene>
  25 + </scenes>
  26 +</document>
CNLiveChatSDKDemo/CNLiveChatSDKDemo/ChatRoomViewController.h 0 → 100644
  1 +//
  2 +// ChatRoomViewController.h
  3 +// CNLiveChatSDKDemo
  4 +//
  5 +// Created by cnliveJunBo on 17/3/8.
  6 +// Copyright © 2017年 cnlive. All rights reserved.
  7 +//
  8 +
  9 +#import <UIKit/UIKit.h>
  10 +
  11 +@interface ChatRoomViewController : UIViewController
  12 +
  13 +@end
CNLiveChatSDKDemo/CNLiveChatSDKDemo/ChatRoomViewController.m 0 → 100644
  1 +//
  2 +// ChatRoomViewController.m
  3 +// CNLiveChatSDKDemo
  4 +//
  5 +// Created by cnliveJunBo on 17/3/8.
  6 +// Copyright © 2017年 cnlive. All rights reserved.
  7 +//
  8 +
  9 +#import "ChatRoomViewController.h"
  10 +
  11 +static NSString *cellId = @"cellId";
  12 +
  13 +@interface ChatRoomViewController ()<UITextFieldDelegate, CNLiveChatManagerDelegate, UITableViewDelegate, UITableViewDataSource> {
  14 +
  15 + NSMutableArray *_messageArrayM;
  16 + NSString *_messageSelf;
  17 +}
  18 +
  19 +@property (nonatomic, strong) UITextField *textField;
  20 +
  21 +@property (nonatomic, strong) UITableView *tableView;
  22 +
  23 +@end
  24 +
  25 +@implementation ChatRoomViewController
  26 +
  27 +- (void)viewDidLoad {
  28 + [super viewDidLoad];
  29 +
  30 + self.view.backgroundColor = [UIColor whiteColor];
  31 +
  32 + self.title = @"聊天室";
  33 +
  34 + self.automaticallyAdjustsScrollViewInsets = NO;
  35 +
  36 + [CNLiveChatManager sharedCNLiveChatManager].delegate = self;
  37 +
  38 + [[CNLiveChatManager sharedCNLiveChatManager] joinChatRoom:@"7788" messageCount:10 success:^(NSString *targetId) {
  39 +
  40 + NSLog(@"已成功加入聊天室:%@",targetId);
  41 +
  42 + } error:^(CNLiveChatErrorCode errors, NSString *targetId) {
  43 +
  44 + NSLog(@"加入聊天室:%@失败,错误码:%ld",targetId,(long)errors);
  45 + }];
  46 +
  47 + [self.view addSubview:self.tableView];
  48 + UITapGestureRecognizer *gestureRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(hideKeyboard)];
  49 + gestureRecognizer.cancelsTouchesInView = NO;
  50 + [self.tableView addGestureRecognizer:gestureRecognizer];
  51 + [self.view addSubview:self.textField];
  52 +
  53 + _messageArrayM = [[NSMutableArray alloc] init];
  54 +}
  55 +
  56 +- (void)viewWillDisappear:(BOOL)animated {
  57 +
  58 + [super viewWillDisappear:animated];
  59 +
  60 + [[CNLiveChatManager sharedCNLiveChatManager] quitChatRoom:@"7788" success:^(NSString *targetId) {
  61 + NSLog(@"退出聊天室:%@成功",targetId);
  62 + } error:^(CNLiveChatErrorCode errors, NSString *targetId) {
  63 + NSLog(@"退出聊天室:%@失败,错误码:%ld",targetId,(long)errors);
  64 + }];
  65 +}
  66 +
  67 +
  68 +#pragma mark - 懒加载 !!!!!!!!!!!!!!!!!!!!!!!!!!
  69 +- (UITextField *)textField {
  70 +
  71 + if (!_textField) {
  72 + _textField = [self createTextFieldWithFrame:CGRectMake(10, 74, KScreenWidth - 20, 40) font:20];
  73 + _textField.delegate = self;
  74 + }
  75 + return _textField;
  76 +}
  77 +
  78 +-(UITableView *)tableView {
  79 + if (!_tableView) {
  80 + _tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 124, KScreenWidth, KScreenHeight - 425) style:UITableViewStylePlain];
  81 + _tableView.rowHeight = 30;
  82 + _tableView.delegate = self;
  83 + _tableView.dataSource = self;
  84 + [_tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:cellId];
  85 + }
  86 + return _tableView;
  87 +}
  88 +
  89 +#pragma mark - UITableViewDelegate,UITableViewDataSource !!!!!!!!!!!!!!!!!!!!!!!!!!
  90 +
  91 +- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
  92 + return 1;
  93 +}
  94 +
  95 +- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
  96 + return _messageArrayM.count;
  97 +}
  98 +
  99 +- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
  100 +
  101 + UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellId forIndexPath:indexPath];
  102 +
  103 + MessageModel *model = _messageArrayM[indexPath.row];
  104 +
  105 + NSMutableAttributedString *AttributedStr = [[NSMutableAttributedString alloc]initWithString:[NSString stringWithFormat:@"%@: %@",model.name,model.message]];
  106 +
  107 + if ([model.userId isEqualToString:[CNLiveChatManager sharedCNLiveChatManager].currentUserInfo.userId]) {
  108 +
  109 + [AttributedStr addAttribute:NSForegroundColorAttributeName
  110 +
  111 + value:[UIColor redColor]
  112 +
  113 + range:NSMakeRange(0, model.name.length)];
  114 +
  115 + cell.textLabel.attributedText = AttributedStr;
  116 + } else {
  117 +
  118 + [AttributedStr addAttribute:NSForegroundColorAttributeName
  119 +
  120 + value:[UIColor blackColor]
  121 +
  122 + range:NSMakeRange(0, model.name.length)];
  123 +
  124 + cell.textLabel.attributedText = AttributedStr;
  125 + }
  126 +
  127 + return cell;
  128 +}
  129 +
  130 +
  131 +#pragma mark - UITextFieldDelegate !!!!!!!!!!!!!!!!!!!!!!!!!!
  132 +- (BOOL)textFieldShouldReturn:(UITextField *)textField { // 发送消息
  133 +
  134 + [[CNLiveChatManager sharedCNLiveChatManager] sendMessage:textField.text type:CNLive_ConversationType_CHATROOM targetId:@"7788" success:^(NSString *targetId, CNLiveChatMessage *message) {
  135 +
  136 + NSLog(@"发送消息成功:%@",message);
  137 + // 自己发送的消息不会被onReceived:方法实时监听,需要自己做处理
  138 + MessageModel *model = [[MessageModel alloc] init];
  139 +
  140 + model.message = _messageSelf;
  141 + CNLiveChatUserInfo *userInfo = [CNLiveChatManager sharedCNLiveChatManager].currentUserInfo;
  142 + model.userId = userInfo.userId;
  143 + model.name = userInfo.name;
  144 + model.portraitUri = userInfo.portraitUri;
  145 + model.type = CNLive_ConversationType_CHATROOM;
  146 +
  147 + [_messageArrayM addObject:model];
  148 +
  149 + // 此处更新 UI 应到主线程
  150 + dispatch_async(dispatch_get_main_queue(), ^{
  151 +
  152 + [self.tableView reloadData];
  153 +
  154 + [self scrollToBottom];
  155 + });
  156 +
  157 + } error:^(CNLiveChatErrorCode errors, NSString *targetId, CNLiveConversationType type) {
  158 +
  159 + NSLog(@"向:%@发送消息失败,错误代码:%ld",targetId,(long)errors);
  160 + }];
  161 +
  162 + _messageSelf = textField.text;
  163 + textField.text = @"";
  164 +
  165 + return YES;
  166 +}
  167 +
  168 +
  169 +#pragma mark - CNLiveChatManagerDelegate !!!!!!!!!!!!!!!!!!!!!!!!!!
  170 +- (void)onReceived:(CNLiveChatMessage *)message {
  171 +
  172 + NSLog(@"收到消息类型:%lu,消息ID:%@,消息内容:%@,消息发送者信息:%@",(unsigned long)message.conversationType,message.targetId,message.messageContent,message.userInfo);
  173 +
  174 + MessageModel *model = [[MessageModel alloc] init];
  175 +
  176 + model.message = message.messageContent;
  177 + model.userId = message.userInfo.userId;
  178 + model.name = message.userInfo.name;
  179 + model.portraitUri = message.userInfo.portraitUri;
  180 + model.type = message.conversationType;
  181 +
  182 + [_messageArrayM addObject:model];
  183 +
  184 + [self.tableView reloadData];
  185 +
  186 + [self scrollToBottom];
  187 +}
  188 +
  189 +- (void)onConnectionStatusChanged:(CNLiveConnectionStatus)status {
  190 +
  191 + NSLog(@"当前连接状态:%ld",(long)status);
  192 +}
  193 +
  194 +- (void)onChatRoomJoined:(NSString *)chatroomId {
  195 +
  196 + NSLog(@"成功加入聊天室:%@",chatroomId);
  197 + NSString *userId = [CNLiveChatManager sharedCNLiveChatManager].currentUserInfo.name;
  198 + NSLog(@"当前账号ID:%@",userId);
  199 +}
  200 +
  201 +- (void)onChatRoomJoinFailed:(NSString *)chatroomId errorCode:(CNLiveChatErrorCode)errorCode {
  202 +
  203 + NSLog(@"加入聊天室:%@失败,错误码:%ld",chatroomId,(long)errorCode);
  204 +}
  205 +
  206 +- (void)kickedByAnotherDevice {
  207 +
  208 + NSString *userId = [CNLiveChatManager sharedCNLiveChatManager].currentUserInfo.userId;
  209 + NSLog(@"账号%@在其他设备登陆",userId);
  210 +}
  211 +
  212 +
  213 +#pragma mark - 创建文本框 !!!!!!!!!!!!!!!!!!!!!!!!!!
  214 +- (UITextField *)createTextFieldWithFrame:(CGRect)frame font:(float)font {
  215 +
  216 + UITextField *textField = [[UITextField alloc] init];
  217 + [textField setFrame:frame];
  218 + textField.returnKeyType = UIReturnKeySend;
  219 + textField.layer.borderWidth = 1.0f;
  220 + textField.layer.cornerRadius = frame.size.height * 0.1;
  221 + [textField setFont:[UIFont systemFontOfSize:font]];
  222 + textField.leftView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, 6, 0)];
  223 + textField.leftViewMode = UITextFieldViewModeAlways;
  224 + return textField;
  225 +}
  226 +
  227 +#pragma mark - tableView 滚到最后一行 !!!!!!!!!!!!!!!!!!!!!!!!!!
  228 +- (void)scrollToBottom {
  229 +
  230 + if (_messageArrayM.count > 0) {
  231 + NSIndexPath *indexPath = [NSIndexPath indexPathForRow:(_messageArrayM.count - 1) inSection:0];
  232 +
  233 + [_tableView scrollToRowAtIndexPath:indexPath atScrollPosition:UITableViewScrollPositionBottom animated:NO];
  234 + }
  235 +}
  236 +
  237 +#pragma mark - 隐藏键盘 !!!!!!!!!!!!!!!!!!!!!!!
  238 +- (void)hideKeyboard {
  239 +
  240 + [self.textField resignFirstResponder];
  241 +}
  242 +
  243 +- (void)didReceiveMemoryWarning {
  244 + [super didReceiveMemoryWarning];
  245 + // Dispose of any resources that can be recreated.
  246 +}
  247 +
  248 +
  249 +@end
CNLiveChatSDKDemo/CNLiveChatSDKDemo/Info.plist 0 → 100644
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
  3 +<plist version="1.0">
  4 +<dict>
  5 + <key>CFBundleDevelopmentRegion</key>
  6 + <string>en</string>
  7 + <key>CFBundleExecutable</key>
  8 + <string>$(EXECUTABLE_NAME)</string>
  9 + <key>CFBundleIdentifier</key>
  10 + <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
  11 + <key>CFBundleInfoDictionaryVersion</key>
  12 + <string>6.0</string>
  13 + <key>CFBundleName</key>
  14 + <string>$(PRODUCT_NAME)</string>
  15 + <key>CFBundlePackageType</key>
  16 + <string>APPL</string>
  17 + <key>CFBundleShortVersionString</key>
  18 + <string>1.0</string>
  19 + <key>CFBundleVersion</key>
  20 + <string>1</string>
  21 + <key>LSRequiresIPhoneOS</key>
  22 + <true/>
  23 + <key>UILaunchStoryboardName</key>
  24 + <string>LaunchScreen</string>
  25 + <key>UIMainStoryboardFile</key>
  26 + <string>Main</string>
  27 + <key>UIRequiredDeviceCapabilities</key>
  28 + <array>
  29 + <string>armv7</string>
  30 + </array>
  31 + <key>UISupportedInterfaceOrientations</key>
  32 + <array>
  33 + <string>UIInterfaceOrientationPortrait</string>
  34 + <string>UIInterfaceOrientationLandscapeLeft</string>
  35 + <string>UIInterfaceOrientationLandscapeRight</string>
  36 + </array>
  37 + <key>UISupportedInterfaceOrientations~ipad</key>
  38 + <array>
  39 + <string>UIInterfaceOrientationPortrait</string>
  40 + <string>UIInterfaceOrientationPortraitUpsideDown</string>
  41 + <string>UIInterfaceOrientationLandscapeLeft</string>
  42 + <string>UIInterfaceOrientationLandscapeRight</string>
  43 + </array>
  44 + <key>NSAppTransportSecurity</key>
  45 + <dict>
  46 + <key>NSAllowsArbitraryLoads</key>
  47 + <true/>
  48 + </dict>
  49 + <key>NSCameraUsageDescription</key>
  50 + <string></string>
  51 + <key>NSMicrophoneUsageDescription</key>
  52 + <string></string>
  53 +
  54 +</dict>
  55 +</plist>
CNLiveChatSDKDemo/CNLiveChatSDKDemo/MessageModel.h 0 → 100644
  1 +//
  2 +// MessageModel.h
  3 +// CNLiveChatDemo
  4 +//
  5 +// Created by cnliveJunBo on 17/2/16.
  6 +// Copyright © 2017年 cnlive. All rights reserved.
  7 +//
  8 +
  9 +#import <Foundation/Foundation.h>
  10 +
  11 +@interface MessageModel : NSObject
  12 +
  13 +@property (nonatomic, strong) NSString *message;
  14 +
  15 +@property (nonatomic, strong) NSString *targetId;
  16 +
  17 +@property (nonatomic, strong) NSString *userId;
  18 +
  19 +@property (nonatomic, strong) NSString *name;
  20 +
  21 +@property (nonatomic, strong) NSString *portraitUri;
  22 +
  23 +@property (nonatomic, assign) NSInteger type;
  24 +
  25 +@end
CNLiveChatSDKDemo/CNLiveChatSDKDemo/MessageModel.m 0 → 100644
  1 +//
  2 +// MessageModel.m
  3 +// CNLiveChatDemo
  4 +//
  5 +// Created by cnliveJunBo on 17/2/16.
  6 +// Copyright © 2017年 cnlive. All rights reserved.
  7 +//
  8 +
  9 +#import "MessageModel.h"
  10 +
  11 +@implementation MessageModel
  12 +
  13 +@end
CNLiveChatSDKDemo/CNLiveChatSDKDemo/PrefixHeader.pch 0 → 100644
  1 +//
  2 +// PrefixHeader.pch
  3 +// CNLiveChatSDKDemo
  4 +//
  5 +// Created by cnliveJunBo on 17/3/8.
  6 +// Copyright © 2017年 cnlive. All rights reserved.
  7 +//
  8 +
  9 +#ifndef PrefixHeader_pch
  10 +#define PrefixHeader_pch
  11 +
  12 +#define KScreenWidth ([UIScreen mainScreen].bounds.size.width > [UIScreen mainScreen].bounds.size.height ? [UIScreen mainScreen].bounds.size.height : [UIScreen mainScreen].bounds.size.width)
  13 +#define KScreenHeight ([UIScreen mainScreen].bounds.size.width > [UIScreen mainScreen].bounds.size.height ? [UIScreen mainScreen].bounds.size.width : [UIScreen mainScreen].bounds.size.height)
  14 +
  15 +#ifdef __OBJC__
  16 +
  17 +#import <CNLiveChatManager/CNLiveChatManager.h>
  18 +#import "MessageModel.h"
  19 +
  20 +#endif
  21 +
  22 +/**
  23 + * 输出测试
  24 + */
  25 +#ifdef DEBUG
  26 +#define NSLog(s, ... ) NSLog( @"[%@ in line %d] ===============>%@", [[NSString stringWithUTF8String:__FILE__] lastPathComponent], __LINE__, [NSString stringWithFormat:(s), ##__VA_ARGS__] )
  27 +#else
  28 +#define NSLog(s, ... )
  29 +#endif
  30 +
  31 +#endif /* PrefixHeader_pch */
CNLiveChatSDKDemo/CNLiveChatSDKDemo/PrivateViewController.h 0 → 100644
  1 +//
  2 +// PrivateViewController.h
  3 +// CNLiveChatSDKDemo
  4 +//
  5 +// Created by cnliveJunBo on 17/3/8.
  6 +// Copyright © 2017年 cnlive. All rights reserved.
  7 +//
  8 +
  9 +#import <UIKit/UIKit.h>
  10 +
  11 +@interface PrivateViewController : UIViewController
  12 +
  13 +@end
CNLiveChatSDKDemo/CNLiveChatSDKDemo/PrivateViewController.m 0 → 100644
  1 +//
  2 +// PrivateViewController.m
  3 +// CNLiveChatSDKDemo
  4 +//
  5 +// Created by cnliveJunBo on 17/3/8.
  6 +// Copyright © 2017年 cnlive. All rights reserved.
  7 +//
  8 +
  9 +#import "PrivateViewController.h"
  10 +
  11 +static NSString *priCellId = @"priCellId";
  12 +
  13 +@interface PrivateViewController ()<UITextFieldDelegate, CNLiveChatManagerDelegate, UITableViewDelegate, UITableViewDataSource> {
  14 +
  15 + NSMutableArray *_messageArrayM;
  16 + NSString *_messageSelf;
  17 +}
  18 +
  19 +@property (nonatomic, strong) UITextField *textField;
  20 +
  21 +@property (nonatomic, strong) UITableView *tableView;
  22 +
  23 +@end
  24 +
  25 +@implementation PrivateViewController
  26 +
  27 +- (void)viewDidLoad {
  28 + [super viewDidLoad];
  29 +
  30 + self.title = @"单聊";
  31 +
  32 + self.view.backgroundColor = [UIColor whiteColor];
  33 +
  34 + self.automaticallyAdjustsScrollViewInsets = NO;
  35 +
  36 + [CNLiveChatManager sharedCNLiveChatManager].delegate = self;
  37 +
  38 + [self.view addSubview:self.tableView];
  39 + UITapGestureRecognizer *gestureRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(hideKeyboard)];
  40 + gestureRecognizer.cancelsTouchesInView = NO;
  41 + [self.tableView addGestureRecognizer:gestureRecognizer];
  42 + [self.view addSubview:self.textField];
  43 +
  44 + _messageArrayM = [[NSMutableArray alloc] init];
  45 +
  46 + [self getPrivateChattingRecords];
  47 +}
  48 +
  49 +#pragma mark - 懒加载 !!!!!!!!!!!!!!!!!!!!!!!!!!
  50 +- (UITextField *)textField {
  51 +
  52 + if (!_textField) {
  53 + _textField = [self createTextFieldWithFrame:CGRectMake(10, 74, KScreenWidth - 20, 40) font:20];
  54 + _textField.delegate = self;
  55 + }
  56 + return _textField;
  57 +}
  58 +
  59 +-(UITableView *)tableView {
  60 + if (!_tableView) {
  61 + _tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 124, KScreenWidth, KScreenHeight - 425) style:UITableViewStylePlain];
  62 + _tableView.rowHeight = 30;
  63 + _tableView.delegate = self;
  64 + _tableView.dataSource = self;
  65 + [_tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:priCellId];
  66 + }
  67 + return _tableView;
  68 +}
  69 +
  70 +#pragma mark - UITableViewDelegate,UITableViewDataSource !!!!!!!!!!!!!!!!!!!!!!!!!!
  71 +
  72 +- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
  73 + return 1;
  74 +}
  75 +
  76 +- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
  77 + return _messageArrayM.count;
  78 +}
  79 +
  80 +- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
  81 +
  82 + UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:priCellId forIndexPath:indexPath];
  83 +
  84 + MessageModel *model = _messageArrayM[indexPath.row];
  85 +
  86 + NSMutableAttributedString *AttributedStr = [[NSMutableAttributedString alloc]initWithString:[NSString stringWithFormat:@"%@: %@",model.name,model.message]];
  87 +
  88 + if ([model.userId isEqualToString:[CNLiveChatManager sharedCNLiveChatManager].currentUserInfo.userId]) {
  89 +
  90 + [AttributedStr addAttribute:NSForegroundColorAttributeName
  91 +
  92 + value:[UIColor redColor]
  93 +
  94 + range:NSMakeRange(0, model.name.length)];
  95 +
  96 + cell.textLabel.attributedText = AttributedStr;
  97 + } else {
  98 +
  99 + [AttributedStr addAttribute:NSForegroundColorAttributeName
  100 +
  101 + value:[UIColor blackColor]
  102 +
  103 + range:NSMakeRange(0, model.name.length)];
  104 +
  105 + cell.textLabel.attributedText = AttributedStr;
  106 + }
  107 +
  108 + return cell;
  109 +}
  110 +
  111 +
  112 +#pragma mark - UITextFieldDelegate !!!!!!!!!!!!!!!!!!!!!!!!!!
  113 +- (BOOL)textFieldShouldReturn:(UITextField *)textField { // 发送消息
  114 +
  115 + [[CNLiveChatManager sharedCNLiveChatManager] sendMessage:textField.text type:CNLive_ConversationType_PRIVATE targetId:@"20170311" success:^(NSString *targetId, CNLiveChatMessage *message) {
  116 +
  117 + NSLog(@"发送消息成功:%@",message);
  118 + // 自己发送的消息不会被onReceived:方法实时监听,需要自己做处理
  119 + MessageModel *model = [[MessageModel alloc] init];
  120 +
  121 + model.message = _messageSelf;
  122 + CNLiveChatUserInfo *userInfo = [CNLiveChatManager sharedCNLiveChatManager].currentUserInfo;
  123 + model.userId = userInfo.userId;
  124 + model.name = userInfo.name;
  125 + model.portraitUri = userInfo.portraitUri;
  126 + model.type = CNLive_ConversationType_CHATROOM;
  127 +
  128 + [_messageArrayM addObject:model];
  129 +
  130 + // 此处更新 UI 应到主线程
  131 + dispatch_async(dispatch_get_main_queue(), ^{
  132 +
  133 + [self.tableView reloadData];
  134 +
  135 + [self scrollToBottom];
  136 + });
  137 +
  138 + } error:^(CNLiveChatErrorCode errors, NSString *targetId, CNLiveConversationType type) {
  139 +
  140 + NSLog(@"向:%@发送消息失败,错误代码:%ld",targetId,(long)errors);
  141 + }];
  142 +
  143 + _messageSelf = textField.text;
  144 + textField.text = @"";
  145 +
  146 + return YES;
  147 +}
  148 +
  149 +
  150 +#pragma mark - CNLiveChatManagerDelegate !!!!!!!!!!!!!!!!!!!!!!!!!!
  151 +- (void)onReceived:(CNLiveChatMessage *)message {
  152 +
  153 + NSLog(@"收到消息类型:%lu,消息ID:%@,消息内容:%@,消息发送者信息:%@",(unsigned long)message.conversationType,message.targetId,message.messageContent,message.userInfo);
  154 +
  155 + MessageModel *model = [[MessageModel alloc] init];
  156 +
  157 + model.message = message.messageContent;
  158 + model.userId = message.userInfo.userId;
  159 + model.name = message.userInfo.name;
  160 + model.portraitUri = message.userInfo.portraitUri;
  161 + model.type = message.conversationType;
  162 +
  163 + [_messageArrayM addObject:model];
  164 +
  165 + [self.tableView reloadData];
  166 +
  167 + [self scrollToBottom];
  168 +}
  169 +
  170 +- (void)onConnectionStatusChanged:(CNLiveConnectionStatus)status {
  171 +
  172 + NSLog(@"当前连接状态:%ld",(long)status);
  173 +}
  174 +
  175 +- (void)kickedByAnotherDevice {
  176 +
  177 + NSString *userId = [CNLiveChatManager sharedCNLiveChatManager].currentUserInfo.userId;
  178 + NSLog(@"账号%@在其他设备登陆",userId);
  179 +}
  180 +
  181 +
  182 +#pragma mark - 创建文本框 !!!!!!!!!!!!!!!!!!!!!!!!!!
  183 +- (UITextField *)createTextFieldWithFrame:(CGRect)frame font:(float)font {
  184 +
  185 + UITextField *textField = [[UITextField alloc] init];
  186 + [textField setFrame:frame];
  187 + textField.returnKeyType = UIReturnKeySend;
  188 + textField.layer.borderWidth = 1.0f;
  189 + textField.layer.cornerRadius = frame.size.height * 0.1;
  190 + [textField setFont:[UIFont systemFontOfSize:font]];
  191 + textField.leftView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, 6, 0)];
  192 + textField.leftViewMode = UITextFieldViewModeAlways;
  193 + return textField;
  194 +}
  195 +
  196 +#pragma mark - 获取私聊最新历史聊天记录 !!!!!!!!!!!!!!!!!!!!!!!!
  197 +- (void)getPrivateChattingRecords {
  198 +
  199 + NSArray *messageArray = [[CNLiveChatManager sharedCNLiveChatManager] getLatestMessages:CNLive_ConversationType_PRIVATE targetId:@"20170311" count:10];
  200 +
  201 + for (CNLiveChatMessage *message in messageArray) {
  202 +
  203 + MessageModel *model = [[MessageModel alloc] init];
  204 +
  205 + model.message = message.messageContent;
  206 + model.userId = message.userInfo.userId;
  207 + model.name = message.userInfo.name;
  208 + model.portraitUri = message.userInfo.portraitUri;
  209 + model.type = message.conversationType;
  210 +
  211 + [_messageArrayM addObject:model];
  212 +
  213 + [self.tableView reloadData];
  214 +
  215 + [self scrollToBottom];
  216 + }
  217 +}
  218 +
  219 +#pragma mark - tableView 滚到最后一行 !!!!!!!!!!!!!!!!!!!!!!!!!!
  220 +- (void)scrollToBottom {
  221 +
  222 + if (_messageArrayM.count > 0) {
  223 + NSIndexPath *indexPath = [NSIndexPath indexPathForRow:(_messageArrayM.count - 1) inSection:0];
  224 +
  225 + [_tableView scrollToRowAtIndexPath:indexPath atScrollPosition:UITableViewScrollPositionBottom animated:NO];
  226 + }
  227 +}
  228 +
  229 +#pragma mark - 隐藏键盘 !!!!!!!!!!!!!!!!!!!!!!!
  230 +- (void)hideKeyboard {
  231 +
  232 + [self.textField resignFirstResponder];
  233 +}
  234 +
  235 +- (void)didReceiveMemoryWarning {
  236 + [super didReceiveMemoryWarning];
  237 + // Dispose of any resources that can be recreated.
  238 +}
  239 +
  240 +
  241 +
  242 +@end
CNLiveChatSDKDemo/CNLiveChatSDKDemo/ViewController.h 0 → 100644
  1 +//
  2 +// ViewController.h
  3 +// CNLiveChatSDKDemo
  4 +//
  5 +// Created by cnliveJunBo on 17/3/8.
  6 +// Copyright © 2017年 cnlive. All rights reserved.
  7 +//
  8 +
  9 +#import <UIKit/UIKit.h>
  10 +
  11 +@interface ViewController : UIViewController
  12 +
  13 +
  14 +@end
  15 +
CNLiveChatSDKDemo/CNLiveChatSDKDemo/ViewController.m 0 → 100644
  1 +//
  2 +// ViewController.m
  3 +// CNLiveChatSDKDemo
  4 +//
  5 +// Created by cnliveJunBo on 17/3/8.
  6 +// Copyright © 2017年 cnlive. All rights reserved.
  7 +//
  8 +
  9 +#import "ViewController.h"
  10 +#import "PrivateViewController.h"
  11 +#import "ChatRoomViewController.h"
  12 +
  13 +@interface ViewController ()
  14 +
  15 +@property (nonatomic, strong) UIButton *privateBtn;
  16 +
  17 +@property (nonatomic, strong) UIButton *chatRoomBtn;
  18 +
  19 +@end
  20 +
  21 +@implementation ViewController
  22 +
  23 +- (void)viewDidLoad {
  24 + [super viewDidLoad];
  25 +
  26 + self.view.backgroundColor = [UIColor whiteColor];
  27 + self.title = @"互动云聊天SDK Demo";
  28 +
  29 + [self.view addSubview:self.privateBtn];
  30 + [self.view addSubview:self.chatRoomBtn];
  31 +
  32 +}
  33 +
  34 +- (UIButton *)privateBtn {
  35 + if (!_privateBtn) {
  36 + _privateBtn = [self createButtonWithFrame:CGRectMake((KScreenWidth - 100) * 0.5, KScreenHeight * 0.3, 100, 30) title:@"单聊"];
  37 + [_privateBtn addTarget:self action:@selector(goToPrivate) forControlEvents:UIControlEventTouchUpInside];
  38 + }
  39 + return _privateBtn;
  40 +}
  41 +
  42 +- (UIButton *)chatRoomBtn {
  43 + if (!_chatRoomBtn) {
  44 + _chatRoomBtn = [self createButtonWithFrame:CGRectMake((KScreenWidth - 100) * 0.5, KScreenHeight * 0.6, 100, 30) title:@"聊天室"];
  45 + [_chatRoomBtn addTarget:self action:@selector(goToChatRoom) forControlEvents:UIControlEventTouchUpInside];
  46 + }
  47 + return _chatRoomBtn;
  48 +}
  49 +
  50 +#pragma mark - Action
  51 +- (void)goToPrivate {
  52 +
  53 + PrivateViewController *private = [[PrivateViewController alloc] init];
  54 + [self.navigationController pushViewController:private animated:YES];
  55 +}
  56 +
  57 +- (void)goToChatRoom {
  58 +
  59 + ChatRoomViewController *chatRoom = [[ChatRoomViewController alloc] init];
  60 + [self.navigationController pushViewController:chatRoom animated:YES];
  61 +}
  62 +
  63 +#pragma mark - 创建button
  64 +- (UIButton *)createButtonWithFrame:(CGRect)frame title:(NSString *)title {
  65 +
  66 + UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];
  67 + [btn setFrame:frame];
  68 + btn.layer.borderWidth = 1.0f;
  69 + btn.layer.cornerRadius = frame.size.height * 0.2;
  70 + [btn setTitleColor:[UIColor colorWithRed:23/255.0 green:110/255.0 blue:254/255.0 alpha:1] forState:UIControlStateNormal];
  71 + [btn setTitleColor:[UIColor grayColor] forState:UIControlStateHighlighted];
  72 + [btn setTitle:title forState:UIControlStateNormal];
  73 + return btn;
  74 +}
  75 +
  76 +- (void)didReceiveMemoryWarning {
  77 + [super didReceiveMemoryWarning];
  78 + // Dispose of any resources that can be recreated.
  79 +}
  80 +
  81 +
  82 +@end
CNLiveChatSDKDemo/CNLiveChatSDKDemo/main.m 0 → 100644
  1 +//
  2 +// main.m
  3 +// CNLiveChatSDKDemo
  4 +//
  5 +// Created by cnliveJunBo on 17/3/8.
  6 +// Copyright © 2017年 cnlive. All rights reserved.
  7 +//
  8 +
  9 +#import <UIKit/UIKit.h>
  10 +#import "AppDelegate.h"
  11 +
  12 +int main(int argc, char * argv[]) {
  13 + @autoreleasepool {
  14 + return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
  15 + }
  16 +}
CNLiveChatSDKDemo/CNLiveMsgTools.framework/CNLiveMsgTools 0 → 100755
No preview for this file type
CNLiveChatSDKDemo/CNLiveMsgTools.framework/Emoji.plist 0 → 100644
No preview for this file type
CNLiveChatSDKDemo/CNLiveMsgTools.framework/Headers/CNLiveMsgManager.h 0 → 100644
  1 +//
  2 +// CNLiveMsgManager.h
  3 +// CNLiveMsgTools
  4 +//
  5 +// Created by cnliveJunBo on 17/2/23.
  6 +// Copyright © 2017年 cnlive. All rights reserved.
  7 +//
  8 +
  9 +#import <Foundation/Foundation.h>
  10 +
  11 +@interface CNLiveMsgManager : NSObject
  12 +
  13 +
  14 ++ (NSString *)getVersion;
  15 +
  16 +
  17 ++ (instancetype)sharedCNLiveMsgManager;
  18 +
  19 +
  20 +- (void)setToolsInfoWithInfoId:(NSString *)infoId
  21 + infoName:(NSString *)infoName
  22 + infoUrl:(NSString *)infoUrl;
  23 +
  24 +
  25 +- (NSDictionary *)getToolsInfo;
  26 +
  27 +
  28 +- (void)initCNLiveMsgToolsWithAppKey:(NSString *)appKey appId:(NSString *)appId;
  29 +
  30 +
  31 +- (void)onLineWithMsgToolsInfoId:(NSString *)infoId
  32 + infoName:(NSString *)infoName
  33 + infoUrl:(NSString *)infoUrl
  34 + success:(void (^)(NSString *toolsId))successBlock
  35 + error:(void (^)(NSInteger errors))errorBlock;
  36 +
  37 +
  38 +- (void)justOnLineSuccess:(void (^)(NSString *toolsId))successBlock
  39 + error:(void (^)(NSInteger errors))errorBlock;
  40 +
  41 +
  42 +- (void)stealthCNLiveMsgTools;
  43 +
  44 +
  45 +- (void)offLineCNLiveMsgTools:(BOOL)isReceivePush;
  46 +
  47 +
  48 +- (void)gatherTogether:(NSString *)targetId
  49 + messageCount:(int)messageCount
  50 + success:(void (^)(NSString *targetId))successBlock
  51 + error:(void (^)(NSInteger errors, NSString *targetId))errorBlock;
  52 +
  53 +
  54 +- (void)gatherIfNullCreate:(NSString *)targetId
  55 + messageCount:(int)messageCount
  56 + success:(void (^)(NSString *targetId))successBlock
  57 + error:(void (^)(NSInteger errors, NSString *targetId))errorBlock;
  58 +
  59 +
  60 +- (void)gatherTogether:(NSString *)targetId
  61 + isCreate:(BOOL)isCreate
  62 + messageCount:(int)messageCount
  63 + success:(void (^)(NSString *targetId))successBlock
  64 + error:(void (^)(NSInteger errors, NSString *targetId))errorBlock;
  65 +
  66 +
  67 +- (void)disperse:(NSString *)targetId
  68 + success:(void (^)(NSString *targetId))successBlock
  69 + error:(void (^)(NSInteger errors, NSString *targetId))errorBlock;
  70 +
  71 +
  72 +- (void)sendCarrier:(NSString *)carrier
  73 + type:(NSInteger)type
  74 + targetId:(NSString *)targetId
  75 + success:(void (^)(NSString *carrier, NSString *targetId, NSInteger type, NSString *infoId, NSString *infoName, NSString *infoUrl))successBlock
  76 + error:(void (^)(NSInteger errors, NSString *targetId, NSInteger type))errorBlock;
  77 +
  78 +
  79 +- (NSInteger)getOnLineStatus;
  80 +
  81 +
  82 +- (BOOL)judgeLoginStatus;
  83 +
  84 +
  85 +- (NSArray *)getLatestCarriers:(NSInteger)type targetId:(NSString *)targetId count:(int)count;
  86 +
  87 +
  88 +
  89 +@end
CNLiveChatSDKDemo/CNLiveMsgTools.framework/Info.plist 0 → 100644
No preview for this file type
CNLiveChatSDKDemo/CNLiveMsgTools.framework/RCConfig.plist 0 → 100644
No preview for this file type
CNLiveChatSDKDemo/CNLiveMsgTools.framework/en.lproj/RongCloudKit.strings 0 → 100644
No preview for this file type
CNLiveChatSDKDemo/CNLiveMsgTools.framework/release_notes_ios.txt 0 → 100755
  1 +Platform: iOS
  2 +Version: 2.8.6 Stable
  3 +Date:2017/02/15
  4 +
  5 +Changing log:
  6 +
  7 +2.8.6 Stable
  8 +-------------------------------
  9 +1、优化并修复了一些偶现的 BUG,增强了稳定性。
  10 +2、增加了聊天室连接状态的监听。
  11 +3、更新红包 SDK。
  12 +4、更新表情 SDK。
  13 +5、优化了 VoIP 部分逻辑。
  14 +
  15 +2.8.5 Dev
  16 +-------------------------------
  17 +1、增加了 VoIP 网络质量回调接口。
  18 +2、增加了小能客服。
  19 +3、优化了 imageCell 和 locationCell。
  20 +4、优化了相册加载速度。
  21 +5、修改了日志格式。
  22 +6、修改了聊天室心跳机制,加入聊天室后开启心跳。
  23 +7、修复了表情区域 ,下载、删除动态表情时,Tab 顺序错乱的问题。
  24 +8、删除了音视频录制接口。
  25 +9、更新了红包 SDK。
  26 +10、进行了多 cmp 连接优化。
  27 +
  28 +2.8.4 Stable
  29 +-------------------------------
  30 +1、客服增加超时提醒配置功能。
  31 +2、修复了发送图片和文件时没有返回 messageUId 的问题。
  32 +3、修复了一些偶现的 BUG,增强了稳定性。
  33 +
  34 +
  35 +2.8.3 Stable
  36 +-------------------------------
  37 +1、优化了群组通知的解析问题。
  38 +2、修复了一些UI细节。
  39 +
  40 +2.8.2 Dev
  41 +-------------------------------
  42 +1、针对苹果ATS的策略进行了适配。
  43 +如果您手动管理依赖,需要在 IMKit 的工程中增加 SafariServices.framework 引用;如果您使用 CocoaPods,请使用 RongCloudIM 新的 spec。
  44 +您可以根据您App的迭代情况,开启和设置https,具体可以参考官网文档。
  45 +2、优化了会话列表自定义 Cell 的 UI 细节。
  46 +
  47 +2.8.1 Stable
  48 +-------------------------------
  49 +1、修复了某些机型上阅读回执的显示问题。
  50 +2、优化了会话列表的刷新。
  51 +
  52 +2.8.0 Dev
  53 +-------------------------------
  54 +1、会话列表、会话界面的重构。
  55 +2、输入法表情、加号区域的重构。
  56 +3、增加了消息搜索功能,现在您可以进行消息搜索了。马上试用吧。
  57 +4、群消息回执增加了详情,现在您可以知道哪些人看过消息,也能知道哪些人没有看过消息了。
  58 +5、增加了文件消息发送过程中的取消功能。
  59 +6、我们将日志进行了标准化,并且支持您通过接口访问。
  60 +7、还修复了很多的小问题。
  61 +
  62 +2.7.3 Stable
  63 +-------------------------------
  64 +1、优化了消息的时间和状态显示
  65 +2、优化了文本超链接的显示效果
  66 +
  67 +2.7.2 Stable
  68 +-------------------------------
  69 +1、修复了几个微小的 BUG。
  70 +
  71 +2.7.1 Dev
  72 +-------------------------------
  73 +1、增加了群组、讨论组消息阅读状态功能,发送一条文本消息后,可查看该消息的阅读用户数。
  74 +2、优化多端群组、讨论组未读消息数同步功能。
  75 +3、历史消息云存储功能,更改为通过导航下发配置控制功能是否开启,去掉了 IMKit 中的开关。
  76 +
  77 +2.7.0 Dev
  78 +-------------------------------
  79 +1、新增了文件消息功能,消息标识为 RC:FileMsg ,消息类名 FileMessage ,需要在”+“号区添加功能后才能使用。
  80 +2、新增了群组、讨论组消息回执功能。
  81 +3、新增了 VoIP 录制功能,录制后文件会自动存储到服务器。
  82 +4、VoIP 支持视频分辨率设置功能。
  83 +5、针对历史消息云存储服务,在 IMKit 中实现了获取历史消息后本地自动存储功能,在 IMLib 中调用获取云端历史消息接口,也会自动存储到本地数据库中。
  84 +6、优化了会话列表及会话中时间显示规则。
  85 +7、对会话界面的 UI 显示样式进行了优化。
  86 +
  87 +2.6.11 Stable
  88 +-------------------------------
  89 +1、这个版本我们完整的适配了 iOS 10。苹果的各项策略总是在不断变更,我们会根据其变化第一时间对 SDK 进行升级。对于近期要发布 App 的客户,我们建议您升级到这个版本。
  90 +2、实时地理位置共享功能,从收费使用变为免费,默认功能打开,请您参考我们的源码来实现。未在源代码里实现该功能的用户不受此次升级影响。
  91 +
  92 +2.6.10 Stable
  93 +-------------------------------
  94 +1、从 8 月 9 日开始,因为苹果针对 iOS10 更新了私有接口审核的标准,导致我们一个内部函数因为重名而违规。会造成在最近几天内提交 App Store 的申请被拒,我们紧急更新了这个版本。已经上线的客户不受影响。您在升级的时候也不需要进行任何接口改动。
  95 +2、针对特别的海外客户和专有部署客户优化,增加一个针对导航的解析功能。普通客户不受影响。
  96 +
  97 +2.6.9 Stable
  98 +-------------------------------
  99 +1、优化了 @ 消息的细节,增加了国际化。
  100 +2、修复了在有 1 万条离线消息以上的情况下,收消息比较慢的问题。解决后 1 万条以上的离线消息可以在 1 分钟以内接收完毕。
  101 +
  102 +2.6.8 Dev
  103 +-------------------------------
  104 +1、群组、讨论组中增加了 @ 功能
  105 +2、增加了消息撤回功能
  106 +3、增加了客服技能组功能
  107 +
  108 +2.6.7 Stable
  109 +-------------------------------
  110 +1、为了美化,进行了一些细微的 UI 更新,包括聊天界面,消息气泡背景,边距等等。并不影响集成使用。
  111 +
  112 +2.6.6 Stable
  113 +-------------------------------
  114 +1、对超长或超宽的图片消息,进行了优化,显示更加美观清晰。
  115 +2、对发送地理位置、会话列表等界面的 UI 设计进行了细微的更新以确保美观。
  116 +
  117 +2.6.5 Stable
  118 +-------------------------------
  119 +1、这个版本主要对 UI 交互进行了一些优化,包括对地理位置消息的图片,图片选择器,输入区域等等。
  120 +
  121 +2.6.4 Stable
  122 +-------------------------------
  123 +1、配合融云的 IM 软件 SealTalk 的发布,对 IMKit 的 UI 进行了一些细节优化,增强了一些体验。不影响您的客户使用。
  124 +2、优化了草稿在会话列表中的显示。
  125 +3、优化了聊天室拉取大量消息时的响应速度。
  126 +4、增加了一个错误码 30015 (RC_CONN_OVERFREQUENCY),如果频繁的调用 connect,会返回此错误码。您只需要调用 connect 函数一次即可。
  127 +
  128 +2.6.3 Stable
  129 +-------------------------------
  130 +1、优化重连逻辑,增强网络连接的可靠性。
  131 +2、修改了一些小的的 UI 问题。
  132 +
  133 +2.6.2 Dev
  134 +-------------------------------
  135 +1、在 2.6.0 版本上出现了几例运营商网络劫持导致连接失败的报告,在这个版本上进行了修复。
  136 +
  137 +2.6.1 Dev
  138 +-------------------------------
  139 +1、提升了用户信息缓存的性能。
  140 +
  141 +
  142 +2.6.0 Dev
  143 +-------------------------------
  144 +1、增加了用户信息缓存,如果您的 App 没有本地用户信息的缓存,将很大的节省您的开发量,同时支持离线缓存,性能更好。使用的方法没有改变。
  145 +2、优化了图片选择器的 UI 功能。
  146 +3、全面增加了对 HTTPS 的支持。
  147 +4、针对消息量非常大的情况下,性能进行了优化。
  148 +5、对客服的业务进行了一些优化。
  149 +
  150 +
  151 +2.5.2 Stable
  152 +-------------------------------
  153 +1、针对 iOS9 以上,支持 IPv6。请注意苹果规定从6月1号起,提交到 App Store 的版本都必须支持 IPv6-only 网络,您需要升级到这个版本。
  154 +2、针对消息量非常大的聊天室进行优化,在网络出错情况下减少了等待时间更快速的自动重连。不影响聊天室以外的场景。
  155 +
  156 +
  157 +2.5.1 Stable
  158 +-------------------------------
  159 +1、优化了部分客服业务的功能。
  160 +2、修复了一个小概率问题,当数据库操作出现意外问题的时候,连接会主动断开。再次重连后可以继续使用。以确保不会因为数据库操作异常而丢失消息。
  161 +
  162 +2.5.0 Stable
  163 +-------------------------------
  164 +1、解决了一个与第三方库冲突问题。
  165 +2、优化了会话列表在 iOS7 及以下系统中 UI 界面的显示效果。
  166 +
  167 +2.4.11 Stable
  168 +-------------------------------
  169 +1、对客服业务进行了小幅度的优化。
  170 +
  171 +2.4.10 Dev
  172 +-------------------------------
  173 +1、发布了新版本的客服界面,请参考开源代码的 RCDCustomServiceViewController 来实现您的客服。新版本客服在性能功能上得到大幅优化,并且您可以自行配置您的界面。之前版本的客服界面仍然兼容。
  174 +2、RCReceivedStatus 增加一个属性 ReceivedStatus_RETRIEVED。表示该消息在当前端离线期间,已经被其他端收取过。您可以根据这个状态更新您的 UI 界面,比如已经被收取过就不再弹出提示。如果您开通了多端登录,请注意您的判断条件,对于没有开通多端同步的用户可以忽略。
  175 +3、再次提高了聊天室的性能。尤其优化了超大型聊天室的消息性能。
  176 +4、同时修复了功能性能上的一些问题。
  177 +
  178 +2.4.9 Dev
  179 +-------------------------------
  180 +1、修复 VoIP 有时显示用户信息错误的问题,修复有时连续拨打 VoIP 不能很好接通的问题。
  181 +2、优化了一下会话界面消息体显示。
  182 +3、增加接口,getMessageByUId,从消息的唯一 ID 获得消息类。
  183 +
  184 +
  185 +2.4.8 Stable
  186 +-------------------------------
  187 +1、富文本消息修复了一个问题,使修改颜色正常起作用。
  188 +2、修复了一个短时间内连续多次点击发送消息,有的消息会不显示的问题。
  189 +3、优化了后台自动重连时的性能。
  190 +
  191 +
  192 +2.4.7 Stable
  193 +-------------------------------
  194 +1、消息阅读状态和对方正在输入状态等功能提交到稳定版。
  195 +2、修复了一些多端同步和发件箱功能引起的问题。
  196 +
  197 +
  198 +2.4.6 Dev
  199 +-------------------------------
  200 +1、新增消息阅读状态功能。发送端可以看到接收端是否阅读了该消息,当前只支持单聊。
  201 +2、新增对方正在输入状态功能。动态显示对方的输入状态,当前只支持单聊。
  202 +3、消息多端同步增加发件箱功能,发送端发出的消息也会被其他端拉取下来。
  203 +4、语音消息的最大长度可以设置,比如您可以设置为您的客户最多只能录制并发送 30 秒的语音,默认是 60 秒。
  204 +
  205 +2.4.5 Stable
  206 +-------------------------------
  207 +1、略微增强了聊天室的性能。修复了一个问题,当客户端同一个 id 加入两个不同的聊天室时,增加了逻辑避免出现显示错误。
  208 +2、当发送消息失败时,如果原因是网络连接已经断开,会自动做一次重连。开发者不需要对此修改做额外处理。
  209 +
  210 +2.4.4 Stable
  211 +-------------------------------
  212 +1、增加读取消息接口getMessage:,可以根据messageId来读取消息。
  213 +2、优化了聊天室逻辑,确保在网络较差情况下不会聊天室掉线。
  214 +3、增加查询聊天室信息接口getChatRoomInfo,您可以查询聊天室成员数目和部分成员ID。
  215 +
  216 +2.4.3 Stable
  217 +-------------------------------
  218 +
  219 +1、增加 messageUId(Universal Id),您可以通过该 UId 匹配一条具体的消息。
  220 +
  221 +2、增加聊天室接口 JoinExistChatroom,加入一个存在的聊天室,如果聊天室不存在则加入不成功。
  222 +
  223 +
  224 +2.4.2 Stable
  225 +-------------------------------
  226 +
  227 +1、增加了聊天室(Chatroom)禁言、封禁两个功能。请通过 Server API 使用。当前用户被禁言或者被封禁后客户端会显示提示。
  228 +
  229 +
  230 +
  231 +2.4.1 Stable
  232 +-------------------------------
  233 +
  234 +1、文本消息和富文本消息,可以通过 RCAttributedLable 的 attributedStrings 属性,给一些文字添加自定义的事件。请参考代码注释中的示例代码。
  235 +2、修复了一个遗留问题,如果您通过 enableMessageAttachUserInfo 在每条消息里携带用户信息,在 IMKit 里会强制显示该用户信息,请打开了这个开关的用户注意。
  236 +
  237 +
  238 +2.4.0 Stable
  239 +-------------------------------
  240 +
  241 +1、修复了一个因为在 IMKit 里直接调用 SendMessage ,极特殊状态下因为网络速度导致返回太快,发送状态没有更新的问题。
  242 +
  243 +2、增加了一种不保存、不计数的 RCCommandMessage(ObjectName 为 RC:CmdMsg),您需要这种类型的消息时可以直接使用,不需要再自定义。
  244 +
  245 +
  246 +
  247 +
  248 +2.3.9 Stable
  249 +-------------------------------
  250 +1、增加功能:未读的语音消息点击后默认连续播放。
  251 +2、增加功能:会话列表界面每条会话的头像右上角的未读数显示可以配置,可以改成红点而不显示未读数。
  252 +3、提高了 UI 显示性能。
  253 +
  254 +2.3.8 Stable
  255 +-------------------------------
  256 +
  257 +1、在 IMKit 中,重新封装了 sendMessage 方法,实现了您在使用这个方法发送消息后自动更新 UI 界面。
  258 +
  259 +2、增加未注册的消息自定义显示功能,通过设置 showUnkownMessage 为 YES,实现在 App 中提示“当前版本不支持查看此消息”。默认值为 NO,没有该需求的用户不用做任何更改。
  260 +
  261 +3、美化了公众服务相关菜单和界面的 UI 展示。
  262 +
  263 +
  264 +2.3.7 Stable
  265 +-------------------------------
  266 +1、新功能语音消息点击后自动播放,增加一个配置可以关闭和打开该功能。
  267 +2、优化了输入框区域点击表情和键盘图片后的交互过程。
  268 +3、美化了公众服务图文消息的显示效果。
  269 +
  270 +
  271 +2.3.6 Stable
  272 +-------------------------------
  273 +1、增加功能:未读的语音消息点击后默认连续播放。
  274 +2、增加功能:会话列表界面每条会话的头像右上角的未读数显示可以配置,可以改成红点而不显示未读数。
  275 +3、提高了 UI 显示性能。
  276 +
  277 +2.3.5 Stable
  278 +-------------------------------
  279 +1、略微调整了网络状态栏、选择图片按钮的布局设计,以更加美观。
  280 +
  281 +
  282 +
  283 +
  284 +2.3.4 Stable
  285 +-------------------------------
  286 +1、增加了语音消息和图片消息质量的配置文件,支持用户在融云平台支持的范围内配置。
  287 +
  288 +2、优化了输入界面的显示效果。
  289 +
  290 +3、增加了稳定性。
  291 +
  292 +
  293 +
  294 +
  295 +2.3.3 Stable
  296 +-------------------------------
  297 +
  298 +1、优化了会话界面下 UI 显示效率。
  299 +2、增加了对 iOS6.0 系统上的一些问题的修改。
  300 +3、修改了iOS7.0 下,当未读消息非常多的时候,反复下拉消息有一定概率崩溃的问题。
  301 +4、增加了对 XCode7 上的 Archive 支持。
  302 +
  303 +
  304 +
  305 +
  306 +2.3.2 Stable
  307 +-------------------------------
  308 +
  309 +1、增加了一个 ImageMessage 的构造方法,从这个版本起可以支持通过参数发送原图。
  310 +
  311 +2、增加群组禁言功能,请配合 Server API 使用。
  312 +
  313 +3、修复了当取消关注公众服务号同时默认删除公众号会话时的一个显示错误。
  314 +
  315 +4、修复了扩展区域功能多于 8 个时,左右滑动时的问题。少于 8 个并不会有问题。
  316 +
  317 +5、略微修改了气泡和名称的布局使其对齐。
  318 +
  319 +6、修复了 VoIP 的问题,目前在 iOS 各版本上使用正常。
  320 +
  321 +2.3.1 Dev
  322 +-------------------------------
  323 +
  324 +1、增加了对 BitCode 编译选项,更好的支持XCode7和iOS9。
  325 +2、将第三方开源语音库 libopencore-armnb.a 独立出来,以方便您同时集成其他第三方组件时避免冲突,请注意把这个库单独包含到您的工程里。
  326 +3、增加了远程通知数据统计,使用 recordLaunchOptionsEvent,recordRemoteNotificationEvent,recordLocalNotificationEvent,您可以将用户点击系统推送的数据记录到融云的后台。
  327 +
  328 +2.3.0 Stable
  329 +-------------------------------
  330 +1、当您需要使用公众服务会话时,您需要在集成会话列表时,主动在 onSelectedTableRow 中添加 RC_CONVERSATION_MODEL_TYPE_PUBLIC_SERVICE,这是为了实现一些用户的自定义需求,请参考 Demo App 源码。
  331 +2、开放了公众号的图文消息点击事件,覆写 didTapImageTxtMsgCell 方法。可以实现自定义跳转。
  332 +3、替换了一个有可能跟其他 SDK 产生冲突的库。
  333 +4、实现了一些新客户的需求。
  334 +
  335 +2.2.11 Dev
  336 +-------------------------------
  337 +
  338 +1、修复了客户反馈的一些问题,增强了稳定性。
  339 +
  340 +
  341 +
  342 +
  343 +2.2.10 Stable
  344 +-------------------------------
  345 +
  346 +1、增加了对系统会话未读消息的计数功能。
  347 +2、优化了公众服务号,单图文、多图文界面的显示。
  348 +3、增加了接口 sendImageMessage:pushContent:appUpload: ,可实现发送图片消息时将图片上传到自已的服务器发送。
  349 +4、会话中阅读新消息时,现实新消息与历史消息分界线提示功能。
  350 +5、增加了 Web 端和手机端用户同时在线状态下,Web 端发送信息手机端能同步发送的功能。
  351 +6、修改 IMKit 和 IMLib 支持最低版本号为 iOS 6.0。
  352 +
  353 +
  354 +2.2.9 Dev
  355 +-------------------------------
  356 +1、修复了轻微的界面问题。
  357 +
  358 +2.2.8 Stable
  359 +-------------------------------
  360 +1、实时地理位置共享功能发布,您可以在融云的 Demo App 上体验该功能。来试试通过 RCRealTimeLocationManager 实现您 App 自己的实时位置共享吧。
  361 +2、修复了一些界面显示相关的小问题。
  362 +
  363 +2.2.7 Stable
  364 +-------------------------------
  365 +1、在会话界面上下滚动时,如果收到新消息,不会自动显示新消息而会停留在当前位置。
  366 +
  367 +2、增加了录音时来电切到后台的处理。
  368 +
  369 +3、解决了一个在 iOS6.0 上的兼容问题。
  370 +
  371 +
  372 +
  373 +2.2.6 Stable
  374 +-------------------------------
  375 +1、开放 appendAndDisplayMessage,用户可以自己加入消息并刷新会话界面。
  376 +
  377 +2、为头像增加长按点击事件。
  378 +
  379 +3、修复了一个文本消息不响应点击事件的 BUG。
  380 +
  381 +4、修复了一个图片库界面显示不美观的问题。
  382 +
  383 +5、修复了一个公众服务的内置浏览器问题。
  384 +
  385 +
  386 +2.2.5 Stable
  387 +-------------------------------
  388 +1、增加了正在连接中的状态。
  389 +2、增强了保护,对于通过 Server API 发送消息传入错误参数导致的问题全面保护。
  390 +3、位置消息增加长按删除。
  391 +4、设置消息免打扰由于网络原因失败时会弹出提示。
  392 +5、增加了界面上的一些定制化功能。
  393 +6、保护了一个发送系统广播时,由于没有针对发送广播的 id 设置用户信息,会导致本地通知不提示的问题。
  394 +7、共享服务平台自定义菜单的发送消息功能已经上线。
  395 +
  396 +2.2.4 Stable
  397 +-------------------------------
  398 +1、删除 reconnect 方法。使用融云 SDK 时,connect 只需要执行一次。对于有场景需要重连时,比如 Token 过期,请使用 connect 方法。其他异常请不要或尽量避免调用重连。
  399 +2、修改了一些界面布局的问题,进行了界面优化。
  400 +3、修改了一个发送图片不显示进度条的问题。
  401 +
  402 +2.2.3 Dev
  403 +-------------------------------
  404 +
  405 +1、删除 reconnect 方法,请不要使用它进行重连。connect 只需要执行一次。对于有特殊业务场景强烈需要重连的用户,请使用 connect 方法。
  406 +2、修改了 joinChatRoom 接口,当加入聊天室时,传入 messageConunt 为 -1 表示不拉取历史消息。
  407 +3、为一些客户的定制化需求优化了显示相关的功能。
  408 +
  409 +2.2.2 Stable
  410 +-------------------------------
  411 +
  412 +1、initWithAppKey 去掉参数 DeviceToken,因为初始化阶段很难获得 DeviceToeken。
  413 +
  414 +2、优化了 setDeviceToken 方法,增加了缓存。
  415 +
  416 +3、增强了重连机制,增加了一些特殊的网络错误的自动重连。
  417 +
  418 +4、修复了一些 iOS 6 系统下的异常。
  419 +
  420 +5、修复了客户反馈的一些异常并增强了稳定性。
  421 +
  422 +
  423 +2.2.1 Dev
  424 +-------------------------------
  425 +
  426 +1、initWithAppKey 去掉参数 DeviceToken,因为初始化阶段很难获得 DeviceToeken,同时优化了 setDeviceToken,做了内部缓存,以帮用户存储正确的值。
  427 +
  428 +2、增强了重连机制。
  429 +
  430 +
  431 +
  432 +2.2.0 Stable
  433 +-------------------------------
  434 +
  435 +1、增加了公众服务自定义菜单。
  436 +
  437 +2、为 sendMessage 增加一个 pushExtra 字段,可以附加消息到 APNS 推送里。
  438 +
  439 +3、增加了 insertMessage 接口。
  440 +
  441 +4、继续优化了连接稳定性和重连机制。
  442 +
  443 +5、为了一些客户定制化需求优化了功能。
  444 +
  445 +6、修复了各种渠道反馈的一些小概率异常和崩溃问题。
  446 +
  447 +
  448 +2.1.4 Stable
  449 +-------------------------------
  450 +
  451 +1.增加了富文本消息的长按事件。
  452 +2.修改了图文消息的布局问题。
  453 +3.会话列表头像设置,放开大小限制。
  454 +4.解决了收到推送后跳转到聊天界面以后,如果有其他人或者群发来消息,导航栏的返回按钮就失效的问题。
  455 +5.修复了 2.1.3 版本上因为修改图片缓存导致发送图片消息会导致无法取到本地图片的问题。
  456 +6.修改了 tokenIncorrect 逻辑,增加了一次场景更准确的反馈该错误信息给客户。
  457 +7.增加了信令用于同步 WebSDK 的会话列表信息。
  458 +8.修复了一个可能导致无法拉取离线消息的小概率问题。
  459 +
  460 +2.1.3 Stable
  461 +-------------------------------
  462 +
  463 +1、Emoji 作为资源文件,可以自定义 Emoji 表情。
  464 +2、修改了 RCContactNotificationMessage 消息解析的一个问题
  465 +3、修改了会话列表最后一条消息显示的一个问题。
  466 +4、修改讨论组用户名显示的一个问题
  467 +5、修改了因为回调指针为空可能导致崩溃的一个底层问题。
  468 +
  469 +
  470 +
  471 +2.1.2 Stable
  472 +-------------------------------
  473 +
  474 +1、增加了一些网络错误状态发生后重连的次数,更容易重连。
  475 +
  476 +2、修改了缓存文件存储的系统路径。
  477 +
  478 +3、增加了公众服务的草稿。
  479 +
  480 +4、Emoji库可以通过资源包替换。
  481 +
  482 +5、修改了上一个版本出现的可能会导致消息发送时一直发不出去的问题。
  483 +
  484 +6、修改了发送语音过程中的一些界面问题。
  485 +
  486 +
  487 +
  488 +
  489 +2.1.1 Stable
  490 +-------------------------------
  491 +
  492 +1、增加了对 Apple WatchKit 的支持,现在您可以直接使用融云的 IMlib 实现 Apple Watch App,我们同时开源了 Demo App。
  493 +
  494 +2、增加了单个 App 内群组的上限,旧的版本不能超过 300 个群组。
  495 +
  496 +3、解决了一些界面在 iOS7.0 上不能使用并崩溃的问题。
  497 +
  498 +4、解决了连续收到多条消息,会话列表刷新错误的问题。
  499 +
  500 +5、解决了自定义消息透传的问题。
  501 +
  502 +6、修复了一些语音消息的功能和界面问题,增加了点击语音消息可以停止语音播放的功能。
  503 +
  504 +7、增加了一些消息的点击事件。
  505 +
  506 +8、当您不在群组/讨论组/聊天室内,而又能进入界面发起消息是,给出文字提示。
  507 +
  508 +9、解决了一个当自动重连时有可能会导致的不发起连接回调的问题。
  509 +
  510 +10、增加了接口 refreshUserInfoCache 和 refreshGroupInfoCache 用于刷新用户信息缓存。
  511 +
  512 +
  513 +
  514 +2.1.0 Stable
  515 +-------------------------------
  516 +1、增强了针对网络切换、网络不稳定时的连接稳定性问题。
  517 +
  518 +2、修改了当网络出现问题,由于消息时间错误导致消息排列错误的问题。
  519 +
  520 +3、修改了断网再连接导致小概率 crash 的问题。
  521 +
  522 +4、修改了会话界面消息时间显示不准确的问题。
  523 +
  524 +5、修改了发送接收表情,有时候显示为空的问题。
  525 +
  526 +6、修复了自定义消息透传的问题。
  527 +
  528 +7、修复了一些对低版本iOS的兼容问题。
  529 +
  530 +8、优化了网络连接缓存机制。
  531 +
  532 +2.0.5 Dev
  533 +-------------------------------
  534 +1、增加了消息置顶之后的显示效果。
  535 +2、增加了新消息提醒打开关闭的功能。
  536 +3、增加了“该账号已在另外一台设备上登录”提示。
  537 +4、修复了会话列表的一些时间顺序和显示问题。
  538 +5、优化了断网和弱网络下的重连机制,更快的从网络中恢复。
  539 +6、修复了小概率情况下收到消息后因为时间错误,导致消息被排列到错误的问题。
  540 +7、修复了一些测试过程中出现的小概率崩溃问题。
  541 +8、增加了连接缓存功能,增强了连接稳定性。
  542 +
  543 +2.0.4 Dev
  544 +-------------------------------
  545 +1、增加了连接稳定性,修复了从后台进入前台后显示网络连接不可用的问题。
  546 +2、修复了一些小概率 Crash 问题。
  547 +3、修复了时间显示错误的问题。
  548 +4、增强了内存优化。
  549 +5、修复了录音和播放录音会跟系统播放冲突的问题。
  550 +6、增加了 DNS 缓存功能,以增强网络连接稳定性。
  551 +
  552 +2.0.3 Dev
  553 +-------------------------------
  554 +1、增加了文本消息中连接高亮显示功能。
  555 +2、修复了会话界面输入法功能的显示问题。
  556 +3、解决了讨论组清空历史消息时会把此讨论组也删除的问题。
  557 +4、解决了系统播放音乐时,收到信息播放提示音之后音乐不继续播放的问题。
  558 +5、解决了发送图片,发送端点击不能放大缩小的问题。
  559 +6、修复了一些可能会显示网络连接不可用的问题。
  560 +
  561 +2.0.2 Dev
  562 +-------------------------------
  563 +1、美化了一些 UI 界面显示。
  564 +2、修复了输入框输入大量字符显示相关的问题。
  565 +3、修复了接收未注册自定义消息显示错误的问题。
  566 +4、解决了接收 API 发送的图文混排消息显示错误的问题。
  567 +5、当手机中无照片时,点击相册默认会提示“无视频和照片”。
  568 +6、修复了发送 60s 语音,有一定概率崩溃的问题。
  569 +7、修复了一些业务层稳定性问题。
  570 +8、修复了在其它页面来新消息没有铃声提示的问题。
  571 +9、修复了发送表情后,点击发送按钮会发送空消息的问题。
  572 +10、解决了图片预览页图片不能放大和缩小的问题。
  573 +
  574 +2.0.1 Dev
  575 +-------------------------------
  576 +1、增强了 UI 显示效果,修改了一些UI问题。
  577 +2、增加了自定义消息展示的接口,更方便的自定义自己消息类型展现。
  578 +3、修复了发送图像,发送端点击缩略图无法打开问题。
  579 +4、修改了一些内存泄露问题。
  580 +
  581 +2.0.0 Dev
  582 +-------------------------------
  583 +1、重构了会话列表界面和会话界面的架构,支持丰富的界面自定义。
  584 +2、支持会话列表的自定义,聚合非聚合显示,支持插入用户自定义数据和展现。
  585 +3、支持自定义会话界面,预置了九种输入框界面。
  586 +4、支持自定义消息的展现,采用自动布局,可以自定义消息界面的展现。
  587 +5、开放了更多的 API 接口和监听。
  588 +6、优化了协议栈的重连机制,现在 App 从断线状态恢复重连将更快。
  589 +7、优化了数据库性能,消息的读写速度将更快。
  590 +8、支持搜索关注公众账号,支持公众账号的详情展现。
  591 +9、支持公众服务多图文消息、单图文消息的展现。
  592 +10、增加了对 Apple Watch 的内置支持。
CNLiveChatSDKDemo/CNLiveMsgTools.framework/zh-Hans.lproj/RongCloudKit.strings 0 → 100644
No preview for this file type