react-native-webrtc: createOffer() promise does not resolve (or reject) on iOS 13.0

createOffer() promise does not resolve (or reject) on iOS 13.0

I was testing with iOS 13.0 recently and I noticed that I was having an error connecting to peers. After some debugging, I found that the createOffer method is not behaving as expected on iOS 13.0. On iOS 12.2, and below, everything works as expected.

Expected behavior

  • Expected createOffer() method in RTCPeerConnection to either resolve or reject promise.

Observed behavior

  • When calling createOffer(), the promise is neither resolved or rejected.

Steps to reproduce the problem

On iOS 13.0:

import * as WebRTC from 'react-native-webrtc';

const configuration = {"iceServers": [{"url": "stun:stun.l.google.com:19302"}]};
const pc = new WebRTC.RTCPeerConnection(configuration);

pc.createOffer().then(desc => console.log(desc)).catch(err => console.log(err))
// nothing happens

on iOS 12.2:

import * as WebRTC from 'react-native-webrtc';

const configuration = {"iceServers": [{"url": "stun:stun.l.google.com:19302"}]};
const pc = new WebRTC.RTCPeerConnection(configuration);

pc.createOffer().then(desc => console.log(desc)).catch(err => console.log(err))
// Successfully resolves.
// RTCSessionDescription {sdp: "v=0[...]}

Platform information

  • React Native version: 0.61.2
  • Plugin version: 1.75.0
  • OS: iOS
  • OS version: 13.0

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 16 (5 by maintainers)

Most upvoted comments

Hello, Guys(@saghul , @spiside ) I faced same problem. But in my case, createOffer() promise does not resolve/reject even iOS 12.4 simulator. I spend a lot of time for resolve this problem. Because my other react-native-webrtc projects worked well, but this time it didn’t work.

Anyway, My solution is just divide RTCPeerConnection and its configuration.

const config = {
  iceServers: [
    {
      urls: 'stun.l.google.com:19302',
    },
  ],
};
const pc = new RTCPeerConnection();
pc.setConfiguration(config);

it works !

I used both the iPhone 8 and the iPhone X for the simulator. Both had the same issue for 13.x. Funny enough, it was the update that upgraded the simulator versions that caused the break. So far I’ve had no troubles using my phone on 13.1 and the 12.2 as the simulator.

I think I’ve narrowed it down even further.

In the constructor for RTCPeerConnection, if I pass in an empty object {} as the configuration param, then the problem goes away. As I’ve dug further into the code, I think the problem happens when creating a RTCPeerConnection from the peer connection factory in the WebRTC module.

Sorry for all the comments, but hopefully this helps with your debugging!

Hey @saghul, thanks for getting back to me. So, this is the funniest/craziest thing: when I build and run from xcode directly, and test with the debugger, an RTCPeerConnection is created! But as soon as I stop running from xcode I get the same issue as before.

To recap: Running react-native run-ios and then launching the app will throw the Error: PeerConnection ID not found.

Running with xcode Build and then run current scheme will work fine…