Discussion Forums  >  WebViews and HTML for Mobile

Replies: 13    Views: 107

farcat
buzztouch Evangelist
Profile
Posts: 1008
Reg: Jan 27, 2012
France
13,230
05/21/13 01:13 PM (10 years ago)

trouble displaying image on html

Hi, I feel very stupid today, I am trying to make an image display in HTML and it just doesn't work. I have done this many many time before but can't see what's wrong in this case. This is for an IOS app (self-hosted), the 5 files have been moved from the downloaded package to Xcode (BT_doc, BT_Images, etc...) I first used the HTML document plugin: I wrote my HTML file, included all the tags and all, moved the file from Finder to BT_Docs. I then moved the corresponding image to BT_Images folder. I can see both the HTML file and the image, all named correctly on Xcode. I compile and although the screen finds the html it shows a question mark as if it couldn't find the image. I double check, make sure both the image and the image tags are named exactly the same (including extension). I clean the project, recompile, same result. I tried using another image from my BT_images folder and it displays fine. I then tried the same using the Custom / HTML text (in case I wrote the html incorrectly). I then inserted <img src="street_map_large.jpg"/> tag, saved. Same result, it just can't find the image. I then tested the HTML on a browser and it plays fine. Any thoughts as to what I am missing? Thanks! Farcat
 
AlanMac
Aspiring developer
Profile
Posts: 2612
Reg: Mar 05, 2012
Esher, UK
37,120
like
05/21/13 01:52 PM (10 years ago)
If you are using an html file, put your image in bt_docs together with the htm file, not bt_images. That should work. Alan
 
farcat
buzztouch Evangelist
Profile
Posts: 1008
Reg: Jan 27, 2012
France
13,230
like
05/21/13 02:02 PM (10 years ago)
Thanks Alan, I have tried that, cleaned, rebuilt and it doesn't do the trick. Here is a screenshot of Xcode, as you can see all is there (I think), that's just weird... https://www.dropbox.com/s/rpgokkh0fkef3m9/screenshot.jpg Cheers, Farcat
 
PSMDanny
Apple Fan
Profile
Posts: 1166
Reg: Dec 09, 2011
Heerlen
21,940
like
05/21/13 02:56 PM (10 years ago)
Hi Farcat, From what I can see: you have the image street_map_large.jpg twice in your project. 1 in BT_Docs and 1 in BT_Images. Try to delete both (move to trash) and drag the image (again) in the BT_Images folder (make sure "Destination" and "add to targets" are checked. Hope this helps. Best Regards, Danny
 
Paul Rogers
Android Fan
Profile
Posts: 2524
Reg: May 30, 2011
UK
35,740
like
05/21/13 02:57 PM (10 years ago)
Hi Farcat, are you sure what Alan suggests doesn't work? The image is in the wrong directory for the path you have in the html, either try again as Alan suggests or make the path /BT_Images/street_map_large.jpg Maybe also try a forward slash before the image name: /street_map_large.jpg
 
Paul Rogers
Android Fan
Profile
Posts: 2524
Reg: May 30, 2011
UK
35,740
like
05/21/13 02:58 PM (10 years ago)
Haha, well spotted Danny!
 
farcat
buzztouch Evangelist
Profile
Posts: 1008
Reg: Jan 27, 2012
France
13,230
like
05/21/13 03:18 PM (10 years ago)
Thanks guys, I have tried all the above with the same result. Frustrating! The app has another odd behaviour, probably not related but I'll mention just in case. I have a few HTML screens that are urls, when I open them I get "Data for this screen has not been downloaded. Please check your internet connection". Now, the plot thickens... I am online, the urls are correct and work on browser but I still get the message. As I said might not be related but just in case. Cheers, Farcat
 
PSMDanny
Apple Fan
Profile
Posts: 1166
Reg: Dec 09, 2011
Heerlen
21,940
like
05/21/13 03:27 PM (10 years ago)
Hi Farcat, I think I know what's going on. When you use the html plugin you create your html and an html document is created on your server. Although it seems like you create an internal html document, actually you create an external document (when you hit save an html file is created on your server). Since you imported the documents inside your xcode project the 'system' is still thinking you are using this 'external' document. After you've imported the html file into xcode you should actually use the "Custom url" plugin to point to the file. Got what I try to say? Best Regards, Danny
 
AlanMac
Aspiring developer
Profile
Posts: 2612
Reg: Mar 05, 2012
Esher, UK
37,120
like
05/22/13 01:53 AM (10 years ago)
You sometimes get some odd glitches with xcode, two of which may apply here. Firstly, when you copy files into a project then move them. If you look at the directory, using the file manager, they may not be where you expect. As Danny suggested, move them to the trash. Then, in xcode, you may see missing entries in red. Delete them too. Do a clean, then copy the images used by the html and the html files into BT_Docs. Secondly, delete any previous builds from the simulator and / or your test device, rebuild and try again. Sometimes, if two differing builds with same target names can exist, which can produce strange results. Lastly, hit refresh with the app running or make sure the latest right config.txt is being used. Use 'publish' to be doubly sure if your app is using 'live' mode config.txt. You are probably closer than you think, which doesn't make it any less frustrating, but I am sure you will get there. Alan
 
farcat
buzztouch Evangelist
Profile
Posts: 1008
Reg: Jan 27, 2012
France
13,230
like
05/22/13 05:24 AM (10 years ago)
What makes it less frustrating is knowing that people are willing to take time off their busy life to help you out! :) Thanks guys. I followed all your instructions and what did it in the end was deleting the libraries. For anyone reading with the same problem: - Finder > Go > Go to Folder - type in ~/Library to temporarily access the Library directory in the Finder - Find ~/Library/Developer/Xcode/DerivedData - Remove all the folder contents Then on your simulator: - iOS Simulator > Reset Content and Settings. I am still left with the url issue though: "Data for this screen has not been downloaded. Please check your internet connection". Looks like a separate issue so I'll start a new thread (sorry). :) Thanks again. Farcat
 
PSMDanny
Apple Fan
Profile
Posts: 1166
Reg: Dec 09, 2011
Heerlen
21,940
like
05/22/13 05:39 AM (10 years ago)
Hi Farcat, Did you have a good read at my answer? If your file(html) is called myhtml.html then use the html doc plugin --> point it to myhtml.html and everything should work If you can't work it out I will try to help you but I need some information. Send me a link (zip) to your project, a url and the login credentials. Best Regards, Danny
 
farcat
buzztouch Evangelist
Profile
Posts: 1008
Reg: Jan 27, 2012
France
13,230
like
05/22/13 05:50 AM (10 years ago)
Thanks Danny! I did read your post carefully but I misunderstood it, I was trying something more complicated than just point to the file. All is good now. Funny that is, I didn't have to that before. Maybe something changed on Buzztouch's side? Anyway, I am happy again. You've all been a great help. Farcat
 
PSMDanny
Apple Fan
Profile
Posts: 1166
Reg: Dec 09, 2011
Heerlen
21,940
like
05/22/13 05:54 AM (10 years ago)
Hi farcat, Glad you solved it. btw: nothing changed regarding this workflow. Whole concept is still the same as it was before! Best Regards, Danny
 
AlanMac
Aspiring developer
Profile
Posts: 2612
Reg: Mar 05, 2012
Esher, UK
37,120
like
05/22/13 06:50 AM (10 years ago)
Nice one, glad you got there.
 

Login + Screen Name Required to Post

pointerLogin to participate so you can start earning points. Once you're logged in (and have a screen name entered in your profile), you can subscribe to topics, follow users, and start learning how to make apps like the pros.