react-native-check-app-install icon indicating copy to clipboard operation
react-native-check-app-install copied to clipboard

Cannot read property 'urlScheme' of undefined

Open dittmarconsulting opened this issue 8 years ago • 5 comments

Here the react-native environment

"react": "16.0.0-alpha.6",
"react-native": "^0.44.0",
"react-native-check-app-install": "0.0.2"

XCode environment

Xcode 8.3.2

Tried to look for linkedin url schema but I get the following error msg Cannot read property 'urlScheme' of undefined

import { AppInstalledChecker, CheckPackageInstallation } from 'react-native-check-app-install'

AppInstalledChecker
        .isAppInstalledIOS('linkedin') // omit the :// suffix
        .then((isInstalled) => {
            console.log(isInstalled)
        })

Is there any way to determine whether LinkedIn is installed or not?

dittmarconsulting avatar Jun 22 '17 03:06 dittmarconsulting

Any update on that?

I really need a solution soon.

I'd love to resolve the issue myself but my Objective C/Swift knowledge is very limited.

Thanks in advance.

dittmarconsulting avatar Jul 10 '17 04:07 dittmarconsulting

Sorry for getting back late Dittmar. I added linked in to the list of apps supported, now the code you pasted above should work. For apps not supported by react-native-check-app-install, you can also google for the URL scheme of the app (in the case of linked in that is linkedin://) and then do AppInstallChecker. checkURLScheme('linkedin'), note the argument to the function is the URL scheme without :// at the end. Thanks for pointing that out to me, there was an error in the README, isAppInstalledIOS should have been checkURLScheme (fixed now)

redpandatronicsuk avatar Jul 10 '17 17:07 redpandatronicsuk

Hi there,

I finally had time to test the new version today. Unfortunately without luck on an iOS device, although it works on Android.

Environment:

"react": "16.0.0-alpha.12",
"react-native": "0.45.0",
"react-native-check-app-install": "0.0.3"
Xcode 8.3.2
iPhone6
iOS 10.2.1

1. I retrieved the list of the supported apps using:

const appList = AppInstalledChecker.getAppList()
console.log(JSON.stringify(appList))

I get the following list (tested on an actual device: iPhone 6 and XCode 8.3.2)

["whatsapp","facebook","facebook messenger","skype","wechat","snapchat","twitter","youtube","netflix","instagram","spotify","slack","pinterest","uber","amazon","soundcloud","google maps","chrome","gmail","google drive","dropbox","google hangouts","evernote","vlc","tumblr","flickr","linkedin"]

which confirms that linkedin is indeed in the list.

2. I tried to confirm whether Linkedin is installed on an actual device (iPhone 6 with Linkedin installed)

AppInstalledChecker
  .isAppInstalledIOS('linkedin') 
  .then(isInstalled => {
    console.log(isInstalled)
  })

which returns false and gives me the following error message:

-canOpenURL: failed for URL: "linkedin://" - error: "This app is not allowed to query for scheme linkedin"

3. Tried checkURLScheme

AppInstalledChecker
  .checkURLScheme('linkedin') 
  .then((isInstalled) => {
    console.log(isInstalled)
  })

which also returns false and gives me the following error message:

-canOpenURL: failed for URL: "linkedin://undefined" - error: "This app is not allowed to query for scheme linkedin"

3. Tried isAppInstalled

AppInstalledChecker
  . isAppInstalled('linkedin') 
  .then((isInstalled) => {
    console.log(isInstalled)
  })

which also returns false and gives me the following error message:

-canOpenURL: failed for URL: "linkedin://" - error: "This app is not allowed to query for scheme linkedin"

NOTE 1: The last method returns true on Android (actual device Nexus 5, Android version 5.1.1 with LinkedIn installed)

NOTE 2: I tried to verify facebook on the iPhone 6 and get the following error message:

-canOpenURL: failed for URL: "fb://requests" - error: "This app is not allowed to query for scheme fb"

NOTE 3: Ran the example app on iPhone6 and it displays the same error messages for all tests and therefore all tests return false

dittmarconsulting avatar Jul 17 '17 01:07 dittmarconsulting

Have you added linkedin:// to your info.plist? They changed some security things since iOS 9, so you need to allow your app first to check for URL. See here: https://github.com/redpandatronicsuk/react-native-check-app-install/issues/1#issuecomment-297018912 If this fixes the issue for me, please let me know. Then I'll add those extra steps to the README to make it clearer for other people who might run into the same issue.

redpandatronicsuk avatar Jul 23 '17 14:07 redpandatronicsuk

i think its good to add this info in README

ButuzGOL avatar Oct 04 '18 14:10 ButuzGOL