我正在使用WebRTC调用创建一个iOS应用。我正在创建RTCPeerConnection,如下所示
RTCICEServer *iceServer = [[RTCICEServer alloc]
initWithURI:[NSURL URLWithString:@"stun:stun.l.google.com:19302"]
username:@""
password:@""];
iceServers = [[NSMutableArray alloc]init];
[iceServers addObject:iceServer];
[RTCPeerConnectionFactory initializeSSL];
RTCPeerConnectionFactory *peerConnectionFactory =
[[RTCPeerConnectionFactory alloc] init];
RTCPeerConnection *peerConnection =
[peerConnectionFactory peerConnectionWithICEServers:iceServers
constraints:nil
delegate:self];
但是,当我尝试向此连接添加媒体流时,应用程序崩溃时没有正确的日志。我尝试过不同的公开STUN / TURN服务器,但结果相同。我猜问题是ICE。对此有何帮助? :)
答案 0 :(得分:1)
问题已解决。我将RTCPeerConnectionFactory和RTCPeerConnection对象声明为局部变量。在调用委托方法之前,它们已被取消分配。我把它们作为实例变量并且它已经修复了。