由于最近使用云信添加聊天功能官辽,記錄一下一些點(diǎn)避免時(shí)間久了忘記云信群聊API,基本包括了所有類? (需要學(xué)習(xí)的也就20粟瞬,30個(gè)同仆,每個(gè)內(nèi)容不多)
1.NIMSDKConfig
2.NIMSDK
3.NIMCustomObject
4.所以Appdelegate開始需要做的就是上面的內(nèi)容
NIMKit是很重要的一個(gè)類:@property (nonatomic,strong)? ? id provider;內(nèi)容提供者戚篙,由上層開發(fā)者注入五鲫。
NIMKitDataProvider:app delegate需要有一個(gè)內(nèi)容提供者,
5.比較小的類可以直接寫在一個(gè)使用它的類里面岔擂,避免文件過多
6.appdelegate(或者M(jìn)ainViewController)加上通知代理位喂,隨時(shí)改變tabbar角標(biāo)
[[NIMSDK sharedSDK].systemNotificationManager addDelegate:self];
[[NIMSDK sharedSDK].conversationManager addDelegate:self];
extern NSString *NTESCustomNotificationCountChanged;
//? ? [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onCustomNotifyChanged:) name:NTESCustomNotificationCountChanged object:nil];
self.sessionUnreadCount? = [NIMSDK sharedSDK].conversationManager.allUnreadCount;
self.systemUnreadCount? = [NIMSDK sharedSDK].systemNotificationManager.allUnreadCount;
self.customSystemUnreadCount = [[NTESCustomNotificationDB sharedInstance] unreadCount];
7.NTESLogManager 的start是云信log記錄浪耘,使用了一個(gè)第三方iOS開源項(xiàng)目之日志框架CocoaLumberjack,CocoaLumberjack是Mac和iOS上一個(gè)集快捷塑崖、簡單七冲、強(qiáng)大和靈活于一身的日志框架。CocoaLumberjack類似于流行 的日志框架(如log4j)弃舒,但它是專為Objective-C設(shè)計(jì)的癞埠,利用了多線程、GCD(如果可用)聋呢、無鎖原子操作Objective-C運(yùn)行時(shí)的 動(dòng)態(tài)特性苗踪。連接文章?
PCH里面加上云信頭文件:
#pragma mark --- 云信
#import "NIMSDK.h"
#import "NTESGlobalMacro.h"
#import "NIMKit.h"
#import#ifdef DEBUG
static DDLogLevel ddLogLevel = DDLogLevelVerbose;
#else
static DDLogLevel ddLogLevel = DDLogLevelInfo;
#endif
8.把方法寫在define里
9.NTESNotificationCenter 的方法里,已經(jīng)在2.4.0版本加上了新消息語音提醒
10.UIImage+NTESColor.h 類 把+ (UIImage *)imageWithColor:(UIColor *)color 方法寫成了類削锰,同時(shí)把通過color得到的圖片做一個(gè)緩存NSCache通铲,這個(gè)是不同之處,?這篇文章可以了解NSCache器贩,它是一種字典颅夺,比字典更有優(yōu)勢(shì),不用考慮線程緩存何時(shí)清理的問題蛹稍。
7.深度定制化UI?
https://github.com/netease-im/NIM_iOS_UIKit