Just blogging this as I had trouble Googling for a solution when it hit me. I've been doing ObjectiveC work lately for the CreativeSDK project and I kept running into an odd problem. I'd set up a simple project, do some work on it, and when I returned the next day, any use of the CreativeSDK would fail. If I removed the frameworks and bundles from my project and re-added them, it worked again. The first time (OK, the first few times) this happened, I just assumed I made a mistake when adding it, but when it happened consistently, I figured something was up.
A large majority of the questions I get about PhoneGap and Cordova revolve around the file system API. It has had some pretty significant updates recently but still remains one of the most difficult ones to use. I've been putting off really digging deep into those questions because many times they are incredibly specific to a particular user's application. And - honestly - they typically don't lend themselves to the type of quick questions I can answer during the day.
So with that in mind, I thought it might be fruitful to ask my readers about the API and how I can help make things a bit clearer - for both you and me. What I'm thinking is - can we come up with a list of basic questions, a FAQ perhaps, for just this API. It can't be something too precise to one particular application, but something that can apply to multiple users.
As an example: How do I download an asset to my application? That's a simple question, but it brings up the question of where you would download the asset and how you would actually use it later.
Of course, the big issue is that this particular API is an evolving one. Anything I do today will be outdated next year. But as most of my blog posts on the API are already over a year old, this would at least be a bit fresher. ;)
In order to organize this list, I'm going to start it in the blog entry. Use the comments to make suggestions, and as I see ones that I think make sense, I'll add them to the list. By the way, I know some of these are super trivial, but I figure it doesn't hurt to try to cover as much as possible.
File System FAQ
- When does it make sense to use the file system (versus LocalStorage or WebSQL)?
- How do I download an asset to my application?
- How do I use a file stored in the file system (both binary and text-based files)?
- How do I check to see if a file exists in a directory?
- Are there external tools that can check a device's file system?
- How do I check to see if a directory exists?
- How do I make a subdirectory where the parent directory may not exist?
- Are there any app store restrictions/guidelines for using the file system?
- For iOS, where can I store files so that they will be backed up to iCloud?
- How can I get metadata (size, updated) about a file?
A few months ago I launched a new GitHub repo (https://github.com/cfjedimaster/Cordova-Examples) as a way to try to collect my various Cordova examples together under one roof. I had planned to add to it regularly but - life - as you know - gets in the way. I've finally gotten around to adding another example, this one for the Media API.
My latest article for Tuts (this time Game Tuts) is now live. In this article I take a deep look at the gamepad API. I blogged about this a while ago but it has finally become (somewhat) more available to modern browsers. And yes, before someone says it, 'more available' doesn't mean 100%. Anyway, I hope you enjoy it: Using the HTML5 Gamepad API to Add Controller Support to Browser Games
About a month or two ago I noticed something odd with my Cordova tests. I'd fire off a call to the iOS simulator by doing
cordova emulate ios. The first time, it worked fine. But as I edited I noticed something odd. Subsequent calls to the emulator would end up in a blank screen in the emulator. If I watched carefully, I'd see my app load for a split second before going black.
Back when Adam Cameron and I launched the ColdFusion UI - The Right Way project, I mentioned that initially we would accept submissions from the community to build out the content before releasing an actual readable version. Turns out I kind of forgot to get around to doing that. The content in the GitHub repo is in Markdown, which is pretty readable, but it isn't exactly in a nice form to hand out to a junior developer.
So my particular part (documentation) isn't publicly available yet, but here is the project:
Earlier this week I came across a person looking to find a local (to Louisiana) car safety inspection location. I think most states require this but they differ on schedules. Louisiana recently moved to letting you pay more for a two-year sticker which is nice, but it is still a bit of a hassle if you don't know where an inspection location can be found. Turns out - there is a web page for it: http://www.dps.state.la.us/safetydirections.nsf/f3f91999370ccaed862574a20074b158?OpenView.
Just a quick note that one of Adobe's ColdFusion team members has discovered a bug with javaSettings. If you don't remember, javaSettings is a way to dynamically load JAR files for a ColdFusion application. This allows you to skip using the CF Admin to work with Java classes. The bug is simple. If you use reloadOnChange:true, which is something you would only do in development anyway, then ColdFusion may have an issue loading the files correctly. To get around this, simply set that value to false, and restart CF. Yes, that is a bit annoying if you are writing the Java classes, but if you are just using some you downloaded, then it is a one-time annoyance. You still get to keep your Java files within your application folder so that's good too. I've filed a bug report for this so feel free to vote/comment on it.
I believe this is the first time this particular presentation has been available, but if I'm wrong, forgive me. My NCDevCon talk on Practical HTML5 is now available for watching online: Practical HTML5. Along with my talk, you can find many others available on their blog. And by the way - NCDevCon has an open call for presentations. This is a great little conference that I've been privileged to attend a few times. I probably won't make it this year due to prior commitments, but I definitely recommend it.