Skip to content
This repository has been archived by the owner on Apr 29, 2021. It is now read-only.

PhoneGap mobile app (iOS) doesn't reload after saving changes to my app files #695

Closed
daxmacrog opened this issue Sep 6, 2016 · 13 comments
Assignees

Comments

@daxmacrog
Copy link

When running PhoneGap Desktop, I am able to load my app in the PhoneGap mobile app (PhoneGap Developer). However, if I save a change to one of my app files (e.g. www/index.html), my app does not reload in PhoneGap on my iPhone. It does reload almost immediately in my desktop browser.

Also, the 3-finger and 4-finger touch functions do not appear to do anything at all.

The only way to load my updated app is to force close the PhoneGap mobile app and relaunch. (This is particularly tedious because I do not keep Bluetooth enabled on my phone, which means I have to touch OK in this warning dialogue that pops up every time: “Turn On Bluetooth to Allow ‘PhoneGap’ to Connect to Accessories.”)

This is the first version of PhoneGap Desktop/Developer that I have used. So I don’t know if this is a new issue. Thanks to everyone who has worked on it for a very useful combination of apps!

  • PhoneGap Desktop 0.3.5
  • PhoneGap Developer (mobile) 1.7.2
  • Mac OS 10.11.6
  • iOS 9.3.5
  • Home network with default Mac OS X firewall enabled
@hermwong hermwong added this to the User Support milestone Sep 7, 2016
@hermwong hermwong self-assigned this Sep 7, 2016
@hermwong
Copy link
Collaborator

hermwong commented Sep 8, 2016

We suspect that this might be an issue in the connect-phonegap dependency used by the PhoneGap Desktop to connect with the PhoneGap Developer App.

We'll spend some time investigating this issue after PhoneGap Desktop 0.4.0 has released.

@hermwong hermwong modified the milestones: 0.4.1 Template bug fixes & minor enhancements, User Support Sep 8, 2016
@hermwong hermwong assigned hollyschinsky and unassigned hermwong Oct 27, 2016
@hollyschinsky
Copy link
Collaborator

@daxmacrog If you're still seeing this issue, could you check the log and paste in what you see?
Here's a screenshot of where to find the log:

log1

Also, if you could try it again after updating to the latest versions of Desktop app and Developer app that would be helpful too.

Thanks!
Holly

@hollyschinsky
Copy link
Collaborator

@daxmacrog @jgacuca567 Also, please make sure you're not entering the http:// in the URL when you're trying to connect to the served app from the developer app. This is a known issue we are fixing.

@daxmacrog
Copy link
Author

@hollyschinsky I've updated to Desktop v0.4.1 and Developer v1.7.6.

See log below. With the Desktop and Developer apps running, I made 2 edits to index.html. My desktop browser refreshed and showed the changes after each saved edit. The Developer app on my iPhone 6s/iOS10 did not show the changes and the 3-finger and 4-finger tap still don't do anything.

Thanks!

starting app server...
listening on 10.0.1.5:3000
200 /api/appzip
undefined Content Security Policy has been added:
200 /api/appzip
file changed /Users/dmr/Pfoma/Apps/com.packafoma.time-lapse-calculator/www/index.html
200 /
200 /style/time-lapse-calculator.css
200 /scripts/time-lapse-calculator.js
200 /cordova.js
200 /scripts/jquery-3.1.0.min.js
304 /socket.io/socket.io.js
200 /socket.io/?EIO=3&transport=polling&t=LXqTTqf
200 /socket.io/?EIO=3&transport=polling&t=LXqTTss&sid=i7ty7vXpGB_76VIXAAAA
200 /fonts/fontawesome-webfont.ttf
200 /socket.io/?EIO=3&transport=polling&t=LXqTTs_&sid=i7ty7vXpGB_76VIXAAAA
500 /cordova_plugins.js
200 /
200 /style/time-lapse-calculator.css
304 /socket.io/socket.io.js
200 /scripts/time-lapse-calculator.js
200 /cordova.js
200 /scripts/jquery-3.1.0.min.js
200 /socket.io/?EIO=3&transport=polling&t=LXqTUZu
200 /socket.io/?EIO=3&transport=polling&t=LXqTUaD&sid=huZ80Efmmq13g_DRAAAB
500 /cordova_plugins.js
200 /fonts/fontawesome-webfont.ttf
file changed /Users/dmr/Pfoma/Apps/com.packafoma.time-lapse-calculator/www/index.html
200 /
200 /style/time-lapse-calculator.css
200 /scripts/jquery-3.1.0.min.js
200 /scripts/time-lapse-calculator.js
304 /socket.io/socket.io.js
200 /cordova.js
200 /socket.io/?EIO=3&transport=polling&t=LXqTYzV
200 /socket.io/?EIO=3&transport=polling&t=LXqTYzc&sid=94zn2JzPFUsWHadLAAAC
500 /cordova_plugins.js
200 /fonts/fontawesome-webfont.ttf
200 /socket.io/?EIO=3&transport=polling&t=LXqTYzl&sid=94zn2JzPFUsWHadLAAAC

@surajpindoria
Copy link
Collaborator

Hi @daxmacrog,

Your logs are similar to what @hollyschinsky and I are seeing. How are you entering the server address into the developer app? If you are using http://10.0.1.5:3000 then that is the issue, you should be fine if you enter just 10.0.1.5:3000.

We are working on a fix for this right now.

@daxmacrog
Copy link
Author

@surajpindoria No http. Just 10.0.1.5:3000.

@hollyschinsky
Copy link
Collaborator

hollyschinsky commented Nov 18, 2016

@daxmacrog Thanks for the info! It's possible that it's related to your CSP. Could you paste in the one you're using? Also, could you try commenting it out and see if that makes any difference? Or try testing your app using this one:

<meta http-equiv="Content-Security-Policy" content="default-src * 'unsafe-inline' gap: ws: https://ssl.gstatic.com;style-src 'self' 'unsafe-inline' data: blob:;media-src *;img-src 'self' data: content:;script-src * 'unsafe-inline' 'unsafe-eval' data: blob:;">

Lastly, if that makes no difference, could you try creating a new project based on one of the templates and see if reload works with that project?

@daxmacrog
Copy link
Author

@hollyschinsky I don't specify a CSP (unless a meta tag is being added by PhoneGap Build). Adding the meta tag you provided didn't have any effect. However, you started me on the right path. While looking into CSP related issues, I stumbled upon this unrelated solution:

phonegap/phonegap-app-developer#287 (comment)

It seems odd, but it worked. I replaced:

<script src="cordova.js"></script>

With:

<script type="text/javascript" src="cordova.js"></script>

It has to be EXACTLY that, apparently. Now the Developer app is refreshing within seconds of saving a change in Coda.

@surajpindoria
Copy link
Collaborator

Ahh yes, we do a regex for that string in particular when we inject the autoreload scripts. Currently we are working on way around this using a plugin instead. Glad you were able to get this to work @daxmacrog!

@hollyschinsky
Copy link
Collaborator

@daxmacrog Awesome!!! Thanks for letting us know and as @surajpindoria mentioned, we're working on a better way to handle this with the connect-phonegap module.

Closing...

@ikishanoza
Copy link

I am not having same issue. In my cordova project, Application is not running in ios 9.3.5 but runs on ios 10.x so i try to google about that and i found there might be issue with the CSP and i found this page i just replace my meta tag with below meta tag..@hollyschinsky

Awesome ..!!! works in both the IOS version.. but now i have a question..can @hollyschinsky tell me what is the meaning of this lines ??
(1) is my previous version meta tag
(2) is my latest meta tag

(1)
<meta http-equiv="Content-Security-Policy" content="default-src * gap: ; script-src 'self' 'unsafe-inline' 'unsafe-eval' *; style-src 'self' 'unsafe-inline' *; img-src 'self' data: *;">

(2)
<meta http-equiv="Content-Security-Policy" content="default-src * 'unsafe-inline' gap: ws: https://ssl.gstatic.com;style-src 'self' 'unsafe-inline' data: blob:;media-src *;img-src 'self' data: content:;script-src * 'unsafe-inline' 'unsafe-eval' data: blob:;">

@thesequelgroup
Copy link

For others that find this thread, this did the trick for me on my Samsung Galaxy tab:
#695 (comment)

@aeskafi
Copy link

aeskafi commented Dec 21, 2017

@hollyschinsky Thanks for the info!
my problem has been solved with "Content-Security-Policy" ...
with best wishes and regards 👍 🥇

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Development

No branches or pull requests

6 participants