lampaa / com.lampa.startapp

Phonegap plugin for check or launch other application in android device.
MIT License
228 stars 120 forks source link

totally broken on iOS; error: "false" #86

Open RikdeBoer opened 7 years ago

RikdeBoer commented 7 years ago

Hello, I'm using this plugin with great success on Android, but cannot for the life of me get it to work for iOS. I ultimately need this to work to invoke WhatsApp on an iPhone, but even when I follow the Twitter example from the documentation, I see the error function called with an error argument of "false".

var sApp = startApp.set("twitter://");
sApp.start(function() { 
    console.log("OK");
}, function(error) { /* fail */
    alert(error);
});

This happens on iOS 10.3, tested on iPhone 5s and iPhone 6s.

Did this ever work this way for iOS? Is this the wrong way to do it? Or did something change in iOS?

Any help greatly appreciated!

Rik

dengxiaoning commented 7 years ago

hello You must configure the LSApplicationQueriesSchemes and URL type properties for your app

var sApp = startApp.set("mopdev://");
sApp.start(function() { /* success */
    console.log("OK");
}, function(error) { /* fail */
    alert(error);
});

qq 20170615132317 qq 20170615133258 qq 20170615133908 qq 20170615133904

RikdeBoer commented 6 years ago

@xdengxiaoning

Thank you for your help and the screenshots. Using iOS 11, I tried to follow your instructions by putting in "whatsapp" at both the URL Types and the LSApplicationQueriesSchemes (via the [ProjectName]-Info.plist file), but to no avail.

var sApp = startApp.set("whatsapp://send?text=Hello");
sApp.start(....); // calls the error function passed in with an argument of "false".
dengxiaoning commented 6 years ago

sorry ! my English is poor.i can't formulation for more situation have . you can refer webstie https://code.tutsplus.com/tutorials/ios-sdk-working-with-url-schemes--mobile-6629.

The two application is configured with scheme in the application I've developed, and the plug-in test is completely successful.

kim3er commented 6 years ago

Thanks for the pointer, @dengxiaoning!

@RikdeBoer I managed to get this working, just by setting LSApplicationQueriesSchemes as below:

screen shot 2017-12-05 at 16 06 53

I used this page as a reference, https://developer.apple.com/documentation/uikit/uiapplication/1622952-canopenurl?language=objc. Note the Important notice under Discussion.