External javascript file not loading in iOS Chrome Mobile App (using Cordova)? Works fine in Android - ios

Any ideas here? I am using Google Polymer with Vulcanize in order to comply with Google's Content Security Policy and not use any inline Javascript in my index.html file, but while it appears to work on Android, it is broken when I try to run it in an iOS emulator.
Is there some iOS specific thing with external javascript files that I should know about? Or any ideas as to why this is happening? Any documentation or something would be helpful, I am only slightly familiar with iOS.
Even a way to get some sort of debugging screen working with xcode would be lovely. I'm using the cordova log plugin to try to get my console.logs to do anything, but nothing is showing up, so I'm just inferring that my external javascript isn't loading.

Related

Ionic 2 Storage does not work on iOS

I am using #ionic/storage as it looked quite promising after reading about it in the V2 Docs.
I use Chrome on my Windows 10 laptop so things appeared to be working perfectly fine at first. However, when I tested it on iPad, or even Firefox on my laptop, I was surprised to find out it did not work.
I was able to resolve the issue on Firefox by removing the sqlite plugin (I thought I will add it when I am ready for native testing):
cordova plugin remove cordova-sqlite-storage --save
Sadly, storage still doesn't work on the iPad. I tested it on Safari and Chrome. I am unable to debug this given the lack of developer tools or console.
I am quite frustrated how Apple makes you dependent on using a Mac to develop on their devices.
How do I go about fixing and debugging this?
I first import storage in Ionic 2:
import { Storage } from '#ionic/storage';
Then to save the data, I do this:
this.storage.set(pk, JSON.stringify(reportObj));
Where pk is just a unique key, and reportObj is an object that I stringify before storing. Again, keep in mind this just doesn't work in iOS.
Thanks.
Update:
So I managed to run the app in Safari and found out that .set actually works and the data gets stored in WebSQL. However, the get does not seem to work and I wasn't able to get any useful errors in the console.
OK, so after a lot of trial and error, I found out that the problem is not really with Storage. There appears to be some other issue with my UI, where it doesn't seem to work on iOS.
I decided to answer the part about testing the app on iOS while in development if you are not a Mac user. The best way for this appears to be to use Ionic View. You can use this simply by typing:
ionic upload
Make sure you create your account. In your iPad or iPhone, you can then download Ionic View app from iTune, sign in, and the app will appear there.
As you upload your code, simply upload again and almost instantly the app would upload on the device as you click Sync.
Hope other Windows users benefit from this.

Ionic v2 app iOS

I'm having trouble with my app when I build it using ionic emulate ios. My loading page is always running (so the index.html) without charging my app. Yet it perfectly works with Chrome Developper Tools.
Does someone know why ?
Thanks by advance !
From the description of your problem, somewhere in the app.ts file you've enabled on launch a loading function but without any explicit duration or was set too long.
If you are using any Cordova Plugins, some bugs won't appear on the Chrome Developer since native functions are not tested so when you use an emulator native bugs become apparent. Try disabling or removing select cordova plugins to determine the root cause.

How to view javascript errors in ios simulator launced by phonegap?

I can't seem to find an answer to this seemingly simple question. I have an app that i've built using the command line phonegap tools and when i start this app it opens up. i am using something called ios_sim (https://github.com/phonegap/ios-sim) which launches the app in the simulator and does not launch xCode (i don't quite understand why this is a feature, it seems like xCode has some useful tools)
Anyhow, my app is not functioning the same way that it does in the browser and i need to debug it. I have also already installed Charles to inspect the requests and i can verify that the correct data is coming from my API so my assumption is that there is some sort of javascript error in rendering the page (the page is partially rendered btw).
All i want to do is view the javascript errors. the same way that you would in the console if you were looking at a web page.
how do you do that?
You have to use Safari Remote Debugging with Web Inspector. See in the relating cordova docs how to do that!

Why Google Chrome for iOS can't work with Facebook JS SDK correctly?

I read a post here. And I'm encountering this issue too. When I use FB.ui({method:'share'}) to share the content, the popup is not correctly working. But when I switched to the "old-school" way, putting a link: http://www.facebook.com/sharer.php?u=... it works fine.
I am just wondering why as a very popular browser, Chrome doesn't support this? Is there any technical reason for this?

Using HTML5 cache manifest with Phonegap on iOS

I've been trying for a while to make my HTML5 cache manifest work with phonegap on iOS devices, but I can't get it working (it does work with the pure web version of the app though).
Has anyone have used it successfully?
(I've only founded two people saying that it has worked (1, 2), but I'm searching for more feedback)
Try having a look at this article
http://tmkmobile.wordpress.com/2012/03/04/html5-offline-solution/
I haven't worked in iOS myself but by the sound of it, as long you have correctly setup your cache spec, it should just work on iOS. Only Android needs a little extra work.

Resources