Showing images referenced in json file on IOS

  • 1
  • Question
  • Updated 7 years ago
Hi All :)
Question. How do I get images that are brough in via a json file into the webview on IOS ?

The build works fine on Android, showing the images, but in IOS it does not....

My build is 417687 and I have the access set as foillows in the config.xml

Any clues?
Photo of Grant

Grant

  • 51 Posts
  • 1 Reply Like

Posted 7 years ago

  • 1
Photo of Grant

Grant

  • 51 Posts
  • 1 Reply Like
Any ideas on this ?
Photo of Grant

Grant

  • 51 Posts
  • 1 Reply Like
Is there anywhere else to get any info on loading/downloading images from an external URL referenced in a json file?
Photo of Grant

Grant

  • 51 Posts
  • 1 Reply Like
I have tried allowing access to the specific folder that holds the images on the external website - but that does not make any difference to the ios
Photo of Grant

Grant

  • 51 Posts
  • 1 Reply Like
It would seem that it is the local storage of the images that is the issue. If we change the js such that just the URL of the image is stored locally then the images show.

When the IOS device has connection.

So, how do we allow the images to be stored locally on ios? Works with android, just not ios...
Photo of Grant

Grant

  • 51 Posts
  • 1 Reply Like
Heeeeeeelp :)
Photo of Grant

Grant

  • 51 Posts
  • 1 Reply Like
Seems it may be because of the filereader onload not working for ios

Please could someone help and give us a clue on how to solve this
Photo of Grant

Grant

  • 51 Posts
  • 1 Reply Like
Tried with 2.7.0 to see if that helps - but all that happens is that the app opens on the iPad - then immediately closes.

Does anyone have any ideas what we could do to get this sorted out ????
Photo of Hyginus Ugwumba

Hyginus Ugwumba

  • 1206 Posts
  • 42 Reply Likes
Hi Grant,

I have look into your app and could not reproduce the problem, I could only open links to google map, I notice you have define your domain whitelist in your config.xml which in guess should be the course of the problem. you can advice exactly how to reproduce this problem.

Thanks
Hyginus
Photo of Grant

Grant

  • 51 Posts
  • 1 Reply Like
Hi Hyginus :)

Ah, did not see your post sorry - before I posted my last one :)

OK, there is supposed to be an image under the google map - have a look at the Home Cooking Restaurant in Restaurants

It works on Android

Very many thanks for having a look at this for us !!!
Photo of Hyginus Ugwumba

Hyginus Ugwumba

  • 1206 Posts
  • 42 Reply Likes
Hi Grant,

Cool , I will make a test with android to see the different..BTW have you try building with the newest phoneGap build version 2.7.0.

I will come back to you on this issue soon.

Thanks
Hyginus
Photo of Grant

Grant

  • 51 Posts
  • 1 Reply Like
Hi Hyginus :)

Yes I have. As mentioned above - 2.7.0 works fine with the Android. But it just opens then closed in about half a second on the iPad 2. I dont get this issue if I stick with 2.5.0
Photo of Hyginus Ugwumba

Hyginus Ugwumba

  • 1206 Posts
  • 42 Reply Likes
Hi Grant,

Oh yup!!..Just to get things right, the original problem was in 2.5.0 and 2.7.0 could not fix this problem as well, did you test in other ioS device or you tested only with ipad.

Thanks in advance for providing more information.

Hyginus
Photo of Grant

Grant

  • 51 Posts
  • 1 Reply Like
Hi Hyginus,

Just tested with an iPhone5 - same issue - no images being shown below the map.

Cheers

Grant
Photo of Grant

Grant

  • 51 Posts
  • 1 Reply Like
Any news Hyginus ?
Photo of Hyginus Ugwumba

Hyginus Ugwumba

  • 1206 Posts
  • 42 Reply Likes
Hi Grant

It seems something went wrong with your javascript, I am still having a look at it. I will get back to you as soon as am able to figure out the problem.

Thanks
Hyginus
Photo of Grant

Grant

  • 51 Posts
  • 1 Reply Like
Many thanks Hyginus :)
Photo of Grant

Grant

  • 51 Posts
  • 1 Reply Like
Any news Hyginus?
Photo of Hyginus Ugwumba

Hyginus Ugwumba

  • 1206 Posts
  • 42 Reply Likes
Hi Grant,

Your javascript "remotedata.js" is showing a wrong implementation of "get XMLHttp". could you try inspecting your js code on chrome browser.

Thanks
Hyginus
Photo of Grant

Grant

  • 51 Posts
  • 1 Reply Like
Thanks Hyginus :)
Looking at the app in Chrome now - no images showing. Trying to find out why now...
Photo of Grant

Grant

  • 51 Posts
  • 1 Reply Like
Hi Hyginus,

It seems that this is an access control issue. But what we don't understand is why this is having an issue with just the images from the json data. it is pulling the other information from the json data without issue.
Photo of Hyginus Ugwumba

Hyginus Ugwumba

  • 1206 Posts
  • 42 Reply Likes
Hi Grant,

Yes...You need check the proper implementation of CORS within browser, I guess IOS will definitely require this to work

Below tutorial could help you out.

http://www.html5rocks.com/en/tutorial...

Let me know how it goes

Thanks
Hyginus
Photo of Grant

Grant

  • 51 Posts
  • 1 Reply Like
Thanks Hyginus - will let you know how it goes...
Photo of Grant

Grant

  • 51 Posts
  • 1 Reply Like
Hi Hyginus,

OK, we figured out what the error in Chrome was - we need to add an htaccess access to the site that we are getting the json file from setting the access control allow origin.

This has resolved the error in the console in chrome etc.

But still having the same issue on the IOS devices of the images not showing - works fine on Android.

Could it be that Filereader is not supported by IOS ?
Photo of Grant

Grant

  • 51 Posts
  • 1 Reply Like
Any news on Filereader being supported in IOS ?
Photo of Grant

Grant

  • 51 Posts
  • 1 Reply Like
Eeek - 8 days now and still cannot get the images to show on IOS when they work just fine in Android.

Any other angles we should be looking at?