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 674AB10BC9 for ; Wed, 24 Jul 2013 16:59:50 +0000 (UTC) Received: (qmail 8733 invoked by uid 500); 24 Jul 2013 16:59:50 -0000 Delivered-To: apmail-cordova-issues-archive@cordova.apache.org Received: (qmail 8634 invoked by uid 500); 24 Jul 2013 16:59:49 -0000 Mailing-List: contact issues-help@cordova.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cordova.apache.org Delivered-To: mailing list issues@cordova.apache.org Received: (qmail 8610 invoked by uid 99); 24 Jul 2013 16:59:48 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 24 Jul 2013 16:59:48 +0000 Date: Wed, 24 Jul 2013 16:59:48 +0000 (UTC) From: "Guopeng Liang (JIRA)" To: issues@cordova.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (CB-4034) Cordova fails to initialize if loading startPage from non application bundle location 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-4034?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13718575#comment-13718575 ] Guopeng Liang commented on CB-4034: ----------------------------------- Hey, I've experienced the deviceready-event-not-firing issue and dug into the cordova.js file (Cordova 2.9.0). I setup some trace in the cordova.js file and got: 2013-07-25 00:44:11.868 DailyCost[41959:a0b] WARN: {"type":"onCordovaReady","handlers":{},"state":2,"fireArgs":[],"numHandlers":0,"onHasSubscribersChange":null} 2013-07-25 00:44:11.868 DailyCost[41959:a0b] WARN: {"type":"onCordovaConnectionReady","handlers":{},"state":1,"fireArgs":null,"numHandlers":0,"onHasSubscribersChange":null} 2013-07-25 00:44:11.868 DailyCost[41959:a0b] WARN: {"type":"onDOMContentLoaded","handlers":{},"state":2,"fireArgs":[],"numHandlers":0,"onHasSubscribersChange":null} 2013-07-25 00:44:11.868 DailyCost[41959:a0b] WARN: {"type":"onCordovaInfoReady","handlers":{},"state":1,"fireArgs":null,"numHandlers":0,"onHasSubscribersChange":null} 2013-07-25 00:44:11.869 DailyCost[41959:a0b] WARN: {"type":"onCordovaInfoReady","handlers":{},"state":1,"fireArgs":null,"numHandlers":0,"onHasSubscribersChange":null} Interestingly in my case, it seems that "onCordovaConnectionReady" is having trouble firing, thus blocking "deviceready" to fire. When I do either of the following modifications, the "deviceready" event fires successfully: #1. Add a setTimeout() around here: setTimeout(function() { channel.join(function() { require('cordova').fireDocumentEvent('deviceready'); }, channel.deviceReadyChannelsArray); }, 0); #2. Add an alert(1) right before the above code (without the setTimeout() wrapper). Based on the above experiment, adding a small delay seems to solve the problem (maybe some synchronization issue in the event firing code?) At this moment the #1 solution works fine for me. I hope this information helps. > Cordova fails to initialize if loading startPage from non application bundle location > ------------------------------------------------------------------------------------- > > Key: CB-4034 > URL: https://issues.apache.org/jira/browse/CB-4034 > Project: Apache Cordova > Issue Type: Bug > Components: iOS > Affects Versions: 2.8.0 > Environment: XCode 4.6.3 > iOS, Cordova 2.8, 2.9 > Reporter: Aleksey Yashchenko > > When loading webview content from outside application bundle (from app Documents folder) Cordova fails to initialize correctly: > - no deviceready event > - some plugins are not working (e.g. Contacts plugin) > There are several other unwanted effects, e.g. when accessign geolocation data user asked for permission twice - first time for the whole app (I assume by the system), second time for loaded page (by webview?). > To reproduce the effect: > - create fresh cordova project > - built/run > - from XCode Organized download application content bundle > - create "Documents/www/*" folder with some tests inside (content of original www folder suits well) > - change AppDelegate: > {quote} > // Set your app's start page by setting the tag in config.xml. > // If necessary, uncomment the line below to override it. > > self.viewController.startPage = [[NSURL fileURLWithPath:[[[MainViewController applicationDocumentsDirectory] stringByAppendingPathComponent:@"www"] stringByAppendingPathComponent:@"index.html"]] absoluteString]; > self.viewController.wwwFolderName = [self.viewController.startPage stringByDeletingLastPathComponent]; > {quote} > - see successful page load event in console log: > {quote} > ...Resetting plugins due to page load. > 2013-06-27 21:54:13.329 HelloWorld[6483:907] Finished load of: file:///var/mobile/Applications/78E63640-C185-401A-9FEE-9B325F8B9881/Documents/www/index.html > {quote} > - deviceready event is not there -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira