JavaScript and CSS not working when PG App deployed to iTunes.

  • 1
  • Problem
  • Updated 4 years ago
After building a PG app targeting iOS, and installing it via iTunes for testing it seems like JavaScript and CSS are not working. When using the PG development tools the application works perfectly. I have Googled this problem, but am finding very limited coverage regarding this problem.
Photo of Jeff Gochin

Jeff Gochin

  • 7 Posts
  • 0 Reply Likes
  • frustrated

Posted 4 years ago

  • 1
Photo of Petra V.

Petra V., Champion

  • 7794 Posts
  • 1391 Reply Likes
Are you using Phonegap Build or do you build locally?
If the former, did you zip up the config and directory structure from the developer app?
Photo of Chris Griffith

Chris Griffith, Champion

  • 347 Posts
  • 92 Reply Likes
Also are the CSS and JS files referenced locally or are they remotely hosted?

If the later, then you probably have issues the content security policy.

If those files are remotely hosted, you may want to include them in your local files. You always need to be thinking about the offline use case.

Chris
Photo of Jeff Gochin

Jeff Gochin

  • 7 Posts
  • 0 Reply Likes
All files are local. And yes the config.xml is in the zip file.
Photo of Petra V.

Petra V., Champion

  • 7794 Posts
  • 1391 Reply Likes
Could it be that your config.xml and index.html are NOT in the same directory?
Photo of Jeff Gochin

Jeff Gochin

  • 7 Posts
  • 0 Reply Likes
No, the directory structure created by PhoneGap developer put the config.xml in the root, and then created a www for my content, which does have an index.html. Do I need to move the config.xml in the www folder?
Photo of Petra V.

Petra V., Champion

  • 7794 Posts
  • 1391 Reply Likes
Both config and index should be in the root.
The best way to do this:
- move config into /www
- adjust paths in config for icons and splashes
- zip up the contents of /www, not the directory

btw: chances are that you are using the config as generated, too, which requires additional changes.
Photo of Jeff Gochin

Jeff Gochin

  • 7 Posts
  • 0 Reply Likes
What additional changes are required to the config.xml?
Photo of Petra V.

Petra V., Champion

  • 7794 Posts
  • 1391 Reply Likes
Can't tell, since you haven't posted your config.xml, yet.
Photo of Jeff Gochin

Jeff Gochin

  • 7 Posts
  • 0 Reply Likes
Got it working iOS, but now the Windows build is not showing anymore.
Photo of JesseMonroy650 (Volunteer)

JesseMonroy650 (Volunteer), Champion

  • 3325 Posts
  • 122 Reply Likes
@Jeff
On Windows see bottom

Canned Message
I need to blog this, so i don't have to repeat this answer again and again.

You cannot use Phonegap Desktop App with Phonegap Build.

Phonegap Desktop App uses Phonegap CLI, so if you want to use Phonegap Desktop App you need to stay with Phonegap CLI.

If you want to use Phonegap Build, then forget what you have done and start over _OR_ make Minor modifications to move Phonegap Desktop App to Phonegap Build. To be clear, the difference is minor, but enough to keep tripping you.

Also, you will not be able to use Phonegap Developer App as that is meant to work with Phonegap Desktop App. You cannot use either CLI or Build with Developer App.

FWIW: I've been trying to get Phonegap to fix this. Here is the report on the issue.

On winphone,
Docs -> Configuring -> The Basics -> Platform Build Selection


<platform name="ios" />
<platform name="android" />
<platform name="winphone" />


Jesse
Photo of Jeff Gochin

Jeff Gochin

  • 7 Posts
  • 0 Reply Likes
@Jesse Thanks!

I was heading down that path, just needed the minimum configuration syntax.
Photo of JesseMonroy650 (Volunteer)

JesseMonroy650 (Volunteer), Champion

  • 3325 Posts
  • 122 Reply Likes
@Jeff,
You are welcome. FWIW: the answer will be read by other people in the future. They will likely want a more complete answer.

Also, Is it clear to you that it might be in your best interest to abandon Phonegap Desktop App?

Jesse
Photo of Jeff Gochin

Jeff Gochin

  • 7 Posts
  • 0 Reply Likes
I am assuming you are eluding to using the CLI instead? Yeah, the "app" was trying to help, but fell short.

I'll be working the CLI in to our CI process very soon.

I have been working with PG for about 24 hours now. It really is great. I was about to reinvent the wheel, but decided to put my ego aside and take a look at PG. It was worth it.

The only problem I have is that I need to move around a lot get all of the keys, certs, aliases, and passwords organized. But, the interface is resilient enough that you can just start over.

In any case, I am very impressed with this community. You have all been very helpful!
Photo of JesseMonroy650 (Volunteer)

JesseMonroy650 (Volunteer), Champion

  • 3325 Posts
  • 122 Reply Likes
@Jeff,
I meant you can use CLI or Phonegap Build (a cloud-base build service by Adobe/Phonegap). CLI is preferred by developers that want either the leading edge or finer resolution (or control) on the process, or both. Build is preferred by developers that dont want the maintance cycle (that feels like a hamster wheel). Build handle multiple development platforms, where CLI requires one to own the hardware.

The assistance you get is from the varied experience and belief that Open Source is the way. This is not to say that spats don't happen on a regular basis, but in the end we all move forward.

Lastly, you will shortfalls in the documentation, so don't be afraid to ask questions. This FAQ should also help. Read the bold sentences.
Top Mistakes by Developers new to Cordova/Phonegap

Best of Luck
Jesse