Return-Path: X-Original-To: apmail-cordova-issues-archive@minotaur.apache.org Delivered-To: apmail-cordova-issues-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 97FA3173EC for ; Thu, 12 Mar 2015 20:49:40 +0000 (UTC) Received: (qmail 5204 invoked by uid 500); 12 Mar 2015 20:49:40 -0000 Delivered-To: apmail-cordova-issues-archive@cordova.apache.org Received: (qmail 5166 invoked by uid 500); 12 Mar 2015 20:49:40 -0000 Mailing-List: contact issues-help@cordova.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list issues@cordova.apache.org Received: (qmail 5144 invoked by uid 99); 12 Mar 2015 20:49:40 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 12 Mar 2015 20:49:40 +0000 Date: Thu, 12 Mar 2015 20:49:40 +0000 (UTC) From: "Shazron Abdullah (JIRA)" To: issues@cordova.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Comment Edited] (CB-7606) handleOpenURL handler firing more than necessary MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/CB-7606?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14359246#comment-14359246 ] Shazron Abdullah edited comment on CB-7606 at 3/12/15 8:49 PM: --------------------------------------------------------------- I re-tested it using cordova-cli 4.3.0 which contains cordova-ios 3.8.0, and it is working with a cold start, and warm start. Here is my updated test case. {code} cordova create CB7606 cb7606.test CB7606 cd CB7606 cordova platform add ios open -a Xcode platforms/ios {code} Add your URL handler in Resources/Info.plist (Open as -> Source Code, add within the at the end): {code} CFBundleURLTypes CFBundleURLName myscheme CFBundleURLSchemes myscheme {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} *First we test warm start:* 1. Launch the app on device using Xcode 2. Press the Home button to put the app in the background 3. In Mobile Safari, enter the url "myscheme://warm" in the Location bar 4. Select the "Go" button on the keyboard 5. Wait until the app launches, and the alert should show *Next we test cold start:* 1. Double press the Home button to show the app switcher (detach from Xcode first) 2. Kill the CB7606 app by flipping the card upwards (might not be there if you detached from Xcode, if its not there that's good) 3. In Mobile Safari, enter the url "myscheme://cold" in the Location bar 4. Select the "Go" button on the keyboard 5. Wait until the app launches, and the alert should show was (Author: shazron): I re-tested it using cordova-cli 4.3.0 which contains cordova-ios 3.8.0, and it is working with a cold start, and warm start. Here is my updated test case. {code} cordova create CB7606 cb7606.test CB7606 cd CB7606 cordova platform add ios open -a Xcode platforms/ios {code} Add your URL handler in Resources/Info.plist (Open as -> Source Code, add within the at the end): {code} CFBundleURLTypes CFBundleURLName myscheme CFBundleURLSchemes myscheme {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} *First we test warm start:* 1. Launch the app on device using Xcode 2. Press the Home button to put the app in the background 3. In Mobile Safari, enter the url "myscheme://warm" in the Location bar 4. Select the "Go" button on the keyboard 5. Wait until the app launches, and the alert should show *Next we test cold start:* 1. Double press the Home button to show the app switcher 2. Kill the CB7606 app by flipping the card upwards 3. In Mobile Safari, enter the url "myscheme://cold" in the Location bar 4. Select the "Go" button on the keyboard 5. Wait until the app launches, and the alert should show > 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: issues-unsubscribe@cordova.apache.org For additional commands, e-mail: issues-help@cordova.apache.org