Quantcast
Channel: Active questions tagged react-native+ios - Stack Overflow
Viewing all articles
Browse latest Browse all 16552

Linking.openURL(url) is not working on iOS (Trying to open Whatsapp)

$
0
0

For some reason, the linking feature to open a whatsapp contact is not working on iOS (it works perfect on Android), i followed the guide on this url for the setup https://reactnative.dev/docs/linking but always when i try to push the button that calls to whatsapp app to write a message directly, the app says something like:

Could not open this link, please review it and try again

The button in my screen app is this

openWhatsappUrl = () => {    const url = 'whatsapp://send?phone=+XXXXXXXXXXX';    Linking.canOpenURL(url).then((supported) => {      if (supported) {        Linking.openURL(url);      } else {        Alert.alert('Alert','WhatsApp is not installed',        );      }    });  };// This is on the render section from my screen<DefaultButton   title="¡Say Hi!"   containerStyles={styles.centeredButton}   onPress={() => this.openWhatsappUrl()}/>

The AppDelegate.m file has this configuration

#import <React/RCTLinkingManager.h>...- (BOOL)application:(UIApplication *)application   openURL:(NSURL *)url   options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options{  return [RCTLinkingManager application:application openURL:url options:options];}

The Info.plist file

<key>LSApplicationQueriesSchemes</key><array><string>whatsapp</string><string>fbapi</string><string>fb-messenger-share-api</string><string>fbauth2</string><string>fbshareextension</string></array>

React Native version

System:OS: macOS Mojave 10.14.6CPU: (4) x64 Intel(R) Core(TM) i5-5350U CPU @ 1.80GHzMemory: 24.91 MB / 8.00 GBShell: 5.3 - /bin/zshBinaries:Node: 10.16.0 - /usr/local/bin/nodeYarn: 1.22.0 - ~/.yarn/bin/yarnnpm: 6.9.0 - /usr/local/bin/npmWatchman: 4.9.0 - /usr/local/bin/watchmanSDKs:iOS SDK:Platforms: iOS 13.2, DriverKit 19.0, macOS 10.15, tvOS 13.2, watchOS 6.1Android SDK:API Levels: 23, 24, 25, 26, 27, 28, 29Build Tools: 23.0.1, 25.0.2, 26.0.1, 26.0.2, 26.0.3, 27.0.3, 28.0.0, 28.0.1, 28.0.2, 28.0.3, 29.0.2System Images: android-26 | Google APIs Intel x86 Atom, android-28 | Google APIs Intel x86 AtomIDEs:Android Studio: 3.0 AI-171.4408382Xcode: 11.3/11C29 - /usr/bin/xcodebuildnpmPackages:react: 16.8.6 => 16.8.6react-native: 0.60.5 => 0.60.5npmGlobalPackages:create-react-native-app: 2.0.2react-native-cli: 2.0.1

Viewing all articles
Browse latest Browse all 16552

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>