How does iOS handle Separate Files

Hi,

On a Mac Latest version.

Doing an app that has a lot of html files that get displayed. I tried dragging the folder that contains all the files but the icons for the files indicate they are shortcuts. However the graphic files seem to be in the project.

I just tried using the shortcut to display:

    NewView.mtFile = "file://html/AboutASPE.html"    

This didn’t work with file:// or file:///

This works using the complete path. I did this just to get things working.

NewView.mtFile = "file:///Users/Rich/Dropbox/Xojo/iOS/Tables/html/AboutASPE.html"

How are the files stored and how do I reference them?

Also I will have a sqlite database, where do I store that?

Thanks

Can somebody point me to where to find out this information?

For the DB, since it is likely read/write, you’ll want to put it in the Documents folder for the iOS app (using SpecialFolder).

You can create your SQLite DB and save it to Documents. Or you can supply it yourself and copy it to Resources using a Copy Files Build Step and then have your app copy it to Documents when it starts.

For the HTML files, copy them to the Resources folder using a Copy Files Build Step. You can then reference each file using FolderItem.URLPath to display into an iOSHTMLViewer. This example worked for me:

[code]
Dim f As FolderItem
// File copied to Resources by a Copy Files Build Step
f = SpecialFolder.GetResource(“MyHTMLFile.html”)

HTMLViewer1.LoadURL(f.URLPath)[/code]

You have an example of the Build Step?

Just add a Copy Files Build step and then drag the file(s) you want to it and set the Destination property to Resources Folder.

Your application can also have files added to and deleted from the DOCUMENTS folder via iTunes after deployment by simply adding one key to the Plist file

I did a short webinar about this feature: iOS File Sharing with iTunes

Can I drag in an entire directory tree like:

html

Will that copy all like this html/.

Will that work.

Then to access them:

Dim f As FolderItem
  // File copied to Resources by a Copy Files Build Step
  f = SpecialFolder.GetResource("html/firstDirectory/MyHTMLFile.html") 
  
  HTMLViewer1.LoadURL(f.URLPath)

Have I got it?

You’d have to try it to be sure, but I suspect if you copy an entire folder you would have to do it something like this:

htmlFolder = SpecialFolder.GetResource("html") f = htmlFolder.Child("MyHTMLFile.html")

I created this method and it works:

[code]Gethtml(lsFilePath as Text)

Dim f As FolderItem
// File copied to Resources by a Copy Files Build Step
f = SpecialFolder.GetResource(“html/” + lsFilePath)

Return f.URLPath
[/code]

Is there anything wrong with this?

I pass it the name with the parent folder: Gethtml(“Folder1/File1.html”)

I guess there is nothing wrong with it, but years of habit with Xojo have taught me to reference files one part at a time to make it easier to check for errors.

Thanks Paul for your help here and at the last 2 conferences!

You need to get this into the docs.

This is in the docs:

http://developer.xojo.com/xojo-io-specialfolder$GetResource

No I mean a complete explanation including explaining the build step.

Like the Xojo docs have explanations and examples.

I know the iOS stuff is all new and it’s going to take a lot of time to get those docs up to the same quality as the rest. It could be a full time job just doing that.

I aim to please:

Copying Files to the Device

[quote=199587:@Paul Lefebvre]I aim to please:

Copying Files to the Device[/quote]

Very nice. Especially the iTunes file sharing. We had several threads about that. Thank you.