webBrowser.openBrowserAsync is not a function - iOS

Hi I’m working on a detached app and I’ve just noticed now I am getting an error when using the webBrowser. It’s been working just fine, this will be the first time I’ve tried it since updating to v20, so i don’t know if that’s relevant. I am running XDE and Xcode, and when I select my element which is supposed to open a webpage, I get

Possible Unhandled Promise Rejection (id: 0):
TypeError: _expo.WebBrowser.openBrowserAsync is not a function. (In '_expo.WebBrowser.openBrowserAsync(url)', '_expo.WebBrowser.openBrowserAsync' is undefined)

I’m not sure what else could have broken it? It’s being imported and used per the docs.

import { WebBrowser } from 'expo'
  openInWebBrowser = async (url) => {
    await WebBrowser.openBrowserAsync(url)

It was the v20 upgrade, I downgraded to v19 and it works. I think maybe I misunderstood the expo kit upgrade process, it looks like actually there is no version 20 yet for ios.

openBrowserAsync exists in both SDK 19 and SDK 20.

ExpoKit does exist for SDK 20.

Thanks @ben - how can I tell which iOS version relates to the correct expo version? The 19 in v1.19.1 is a little confusing but I assume that’s nothing to do with the SDK version.

I’ve uploaded my app to iTunes Connect to test on TestFlight and when I open the app, I get "Error while loading: No version of …appname… compatible with this version of Exponent (SDK versions 19.0.0 and platform “iOS”). I’m assuming that’s because I’m using 1.19.1 with SDK 19?

heya, can you update your version of the “expo” js package to the latest version? that should resolve the problem

Ah sorry I can see it in the release notes now, referring to the version of React Native that it relates to.

interesting… I have run into the same problem today. I have no issue like 2 days ago and today, the web browser starts giving me this error.
Updating expo to 20.1.1 resolved the issue :smiley:

@notbrent are you referring to the app crashing? I changed the iOS release version to 1.18.2 to go with expo SDK 19.0 but that didn’t work, app still fails through Test Flight. (No version of …appname… compatible with this version of Exponent (SDK versions 19.0.0 and platform “iOS”))

If I upgrade to latest expo SDK with ios/1.19.1 it should hopefully work?

Can I also please clarify if I should be uploading the .xcodeproj file or the .xcworkspace file to iTunes Connect? Thanks!

I upgraded back to SDK v20 and it works… so really not sure why it didn’t work in the first place. Pretty sure I had the same setup but maybe not?

When I say it works, it works in the simulator, but when I run it on the device through Test Flight and iTunes connect, nothing happens when I click on a link that is supposed to open WebBrowser. There’s no feedback so not sure why.

@ben could this be related to Issues with Linking from WebBrowser in Standalone app ?

I’m using WebBrowser to open other websites and it works when running the app in the Xcode simulator. (to clarify, I’ve detached and am using Expo Kit). However when I publish to iTunes Connect and run the app through simulator, nothing happens when I click on a link in my app. No sign of a Web Browser opening and no error message. I’m not sure how to debug this as it only happens on Test Flight. Doesn’t happen either when I use my Phone as the sim device through Xcode.

If it’s related to the issue linked above, how can I get the latest version? Given that my app is detached, I can’t run exp build:ios.


I read back through the docs and realised that I needed to Publish the app through XDE first. I’m able to get WebBrowser to work on the Test Flight app now. :sweat_smile:

This is just something I noticed.

I had to use

WebBrowser.WebBrowser.openBrowserAsync( URI )

Im using the latest SDK (21.0.0) running on MacOS emulation on iOS.

I’ll create a new post with this information if there’s not already one for this version of the sdk.

1 Like