Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot read property 'urlScheme' of undefined #2

Open
dittmarconsulting opened this issue Jun 22, 2017 · 5 comments
Open

Cannot read property 'urlScheme' of undefined #2

dittmarconsulting opened this issue Jun 22, 2017 · 5 comments

Comments

@dittmarconsulting
Copy link

dittmarconsulting commented Jun 22, 2017

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
Copy link
Author

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.

@redpandatronicsuk
Copy link
Owner

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)

@dittmarconsulting
Copy link
Author

dittmarconsulting commented Jul 17, 2017

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

@redpandatronicsuk
Copy link
Owner

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: #1 (comment)
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.

@ButuzGOL
Copy link

ButuzGOL commented Oct 4, 2018

i think its good to add this info in README

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants