ios - QBR session 始终为空

标签 ios quickblox

我在我的应用程序中使用 Quickblox 进行视频通话,我注册并成功登录,但是每当我尝试使用以下行创建 QBRTCSession 时,我总是得到一个 nill,请帮助我。

QBRTCSession* videoSession = [QBRTCClient.instance createNewSessionWithOpponents:opponentsIDs withConferenceType:QBRTCConferenceTypeVideo];

下面是我的全部代码:

    [QBRequest logInWithUserEmail:[userDefaults valueForKey:@"loginEmail"] password:[userDefaults valueForKey:@"loginPassword"] successBlock:^(QBResponse * _Nonnull response, QBUUser * _Nullable user) {

    NSError* error;
    QBUUser* theUser = [QBUUser user];
    theUser.ID = 00000;
    [QBChat.instance connectWithUser:theUser completion:^(NSError * _Nullable error) {
    }];

    [userDefaults setInteger:user.ID forKey:@"userId"];
    [userDefaults synchronize];
    [QBRTCClient initializeRTC];

    [QBRTCConfig setAnswerTimeInterval:60];
    [QBRTCConfig setDialingTimeInterval:10];
    [QBRTCConfig setDisconnectTimeInterval:30];//        [QBRTCConfig setDTLSEnabled:false];

    [[QBRTCMediaStreamConfiguration alloc] init];
    configurations.audioCodec = QBRTCAudioCodeciLBC;
    configurations.videoCodec = QBRTCVideoCodecH264;
    [QBRTCConfig setICEServers:[self quickbloxICE]];
    [QBRTCConfig setMediaStreamConfiguration:configurations];
    [QBRTCConfig setStatsReportTimeInterval:1.f];

    [QBRTCClient.instance addDelegate:self];
    NSArray* opponentsIDs = @[@000000];
    [QBSettings setAutoReconnectEnabled:YES];

    QBRTCSession* videoSession = [QBRTCClient.instance createNewSessionWithOpponents:opponentsIDs withConferenceType:QBRTCConferenceTypeVideo];

    CallViewController *callViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"CallViewController"];
    callViewController.session = videoSession;
    callViewController.initiator = user;
 [self presentViewController:callViewController animated:NO completion:nil];
} errorBlock:^(QBResponse * _Nonnull response) {

    NSLog(@"%@",[response.error description]);
}];

- (NSArray *)quickbloxICE {

NSString *password = @"baccb97ba2d92d71e26eb9886da5f1e0";
NSString *userName = @"quickblox";

QBRTCICEServer *server = [QBRTCICEServer serverWithURL:@"https://myserver:port" username:@"" password:@""];

QBRTCICEServer * stunServer = [QBRTCICEServer serverWithURL:@"stun:turn.quickblox.com"
                                                   username:@""
                                                   password:@""];

QBRTCICEServer * turnUDPServer = [QBRTCICEServer serverWithURL:@"turn:turn.quickblox.com:3478?transport=udp"
                                                      username:userName
                                                      password:password];

QBRTCICEServer * turnTCPServer = [QBRTCICEServer serverWithURL:@"turn:turn.quickblox.com:3478?transport=tcp"
                                                      username:userName
                                                      password:password];


return@[server,stunServer, turnTCPServer, turnUDPServer];}

最佳答案

连接到聊天后请创建新的QBRTCSession实例:

[QBChat.instance connectWithUser:theUser completion:^(NSError * _Nullable error) {
    QBRTCSession* videoSession = [QBRTCClient.instance createNewSessionWithOpponents:opponentsIDs withConferenceType:QBRTCConferenceTypeVideo];
}];

关于ios - QBR session 始终为空,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34960607/

相关文章:

android - QuickBlox Android SDK 1.2 不再在 14 之前的 Android API 上运行

ios - SwiftUI - 环境对象不更新 UI

ios - UITableView 决定单个行高

ios - 如何保护(加密)webkit/local store 存储的数据

ios 如何每天运行方法?

ios - Quickblox 聊天应用 : new message received should fire the appropriate uitableviewcell

ios - Quickblox : How to add user in friend list?

ios - 用户使用社交提供商的 [facebook] token 登录 QuickBlox

ios - 带有静态库的体系结构 armv7 的 undefined symbol

iphone - 将在Interface Builder中制作的自定义表格单元格与three20一起使用