Hey guys - Im using a WebView to get access to pixel information via canvas.
I'd like to load a photo from the library and save a copy to the app data folder (this works fine), but I then need to load that photo to an image object, in a WebView. Is it possible to get the URL of this image; absolute or relative?
I've tried installing a copy of the HTML to the app data folder to use local paths. This actually works in the simulator, but does not work on the iPad. I don't mind digging some more, but I don't know if I'm wasting my time.
More information and a solution:
This was an incredibly painful issue to figure out. Upon further inspection, everything was being installed on device except for the HTML document. This was not true for the Simulator, where both were installing just fine.
For background, I was installing an HTML and JPG document from Resources to the Documents folder (Application Data) - However, only the image document was installing correctly.
Solution? I changed the extension of the HTML document to TXT and it works just fine.
Something to do with the encoding? Maybe extension length? Possibly. For now, the solution works, but it's time to go cry in a pillow for taking so long to find an answer. :-)
As with my issues in the past, do note that if it works in the Simulator, it doesn't always work on device. Third issue where this has been the case.
Final testing. This did seem to be an issue with extension length. Went with .htm and everything is good. Silly inconsistency. ;-)
If it works in simulator it must work on device too.
Take care that the device is filename case sensitive while the simulator is not.
Solution is above. :-)
If a file is in the Application Data directory for an app (which is the only place files can be written) the reference (src for an img tag) needs to be prefixed with file:/// followed by the full system path to the resources directory.