接收广播
- TalkfunSDKLiveDelegate
- (void)onBroadcast:(TFBroadcast*)resul
获取全部的广播
-(void)getBroadcastsList:(void (^__nullable)(NSInteger code ,NSMutableArray <TFBroadcast *>*_Nullable list ,TFError *_Nullable error))callback
获取未收到的广播
-(void)getBroadcastsUnreceivedList:(void (^__nullable)(NSInteger code ,NSMutableArray <TFBroadcast *>*_Nullable list ,TFError *_Nullable error))callback
----------------------下面的代码为过期的方法,不建议使用----------------------
广播
广播: TALKFUN_EVENT_BROADCAST
@参数说明:
参数 | 类型 | 描述 |
---|---|---|
message | NSString | 广播信息 |
__auto | NSNumber | 是否自动发给后来者 |
uniqid | NSString | 广播唯一标识 |
t | NSNumber | 时间戳 |
调用示例:
[self.talkfunSDK on:TALKFUN_EVENT_BROADCAST callback:^(id obj) {
//返回数据
{
"__auto" = 1;
message = "854321.0";
t = 1457086318;
uniqid = 56d95f6e08367;
}
}];
获取全部的广播
调用示例:
[self.talkfunSDK getBroadcasts:^(id result) {
if ([result isKindOfClass:[NSArray class]]) {
dispatch_async(dispatch_get_main_queue(), ^{
NSMutableArray *array = result;
if (array.count>0) {
[weakSelf broadcast: result[0]];
}
});
}
}];
获取未收到的广播
调用示例:
[self.talkfunSDK getBroadcastsUnreceived:^(id result) {
if ([result isKindOfClass:[NSArray class]]) {
dispatch_async(dispatch_get_main_queue(), ^{
NSMutableArray *array = result;
if (array.count>0) {
[weakSelf broadcast: result[0]];
}
});
}
}];