[
https://issues.apache.org/jira/browse/CB-7606?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14315331#comment-14315331
]
Shazron Abdullah commented on CB-7606:
--------------------------------------
Ok the fix is ready, in the CB-7606 branch. I've tested it using a cold and
warm start. Instructions:
{code}
cordova create CB-7606 cb.7606.test CB-7606
cordova platform add ios@CB-7606 --usegit
open -a Xcode platforms/ios
{code}
Add your URL handler in Info.plist (Open as Source Code, add within the <dict>):
{code}
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLName</key>
<string>myscheme</string>
<key>CFBundleURLSchemes</key>
<array>
<string>myscheme</string>
</array>
</dict>
</array>
{code}
Edit your Scheme (click on the Target in the Xcode toolbar):
{code}
1. Select the Launch Tab
2. Select the Launch (Wait for Executable to be Launched) radio button
{code}
Add this at the top of the Staging/www/js/index.js file in Xcode Project
Navigator:
{code}
function handleOpenURL(url) {
setTimeout(function() {
alert(url);
}, 500);
}
{code}
To test:
{code}
1. In Mobile Safari, enter the url "myscheme://" in the Location bar
2. Select the "Go" button on the keyboard
3. Wait until the app launches, and the alert should show
4. Press the Home button
5. Repeat Steps 1, 2 and 3 to now test warm start.
{code}
Please test, let me know so I can land this in 3.8.0 and start the release
process.
> handleOpenURL handler firing more than necessary
> ------------------------------------------------
>
> Key: CB-7606
> URL: https://issues.apache.org/jira/browse/CB-7606
> Project: Apache Cordova
> Issue Type: Bug
> Components: iOS
> Affects Versions: 3.5.0
> Reporter: Paul Kane
> Assignee: Shazron Abdullah
> Fix For: 3.8.0
>
>
> I'm not an Obj-C or Cordova programmer so bear with me.
> Let's say my app is running. Then I hop over to my mail app and click on a
> link (myapp://blahBlahBlah) that should open up my app. This works fine, the
> app opens, my own URL handler (in javascript) takes over, etc.
> However in Obj-C the view controller is -- incorrectly, I believe -- storing
> that scheme data (blahBlahBlah) in self.openURL (so that it can be picked up
> later in processOpenURL function, called during webView initialization).
> This isn't normally a problem, except when you move to a new page
> (window.href = "/new_page"), the webView initialization runs again and picks
> up the old (already-acted-upon) openURL variable. (it's then set to nil, so
> that it doesn't get acted upon a third time, fourth time, etc...).
> I might have some details wrong, but it should be fairly easy to walk through
> with a project-wide search for "openurl". Just seems like a slightly wrong
> logic-flow, which unfortunately is interfering with my app.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]