After trying almost a DAY to figure out why the hell I can’t make the Phonegap’s file API to play nice on iOS 4.x, even if on iOS 5.x everything was just peachy, i tried very last thing i got on my head.

Ok, so I had this snippet of code:

var preview = $('<img />').attr({src : 'data:image/jpeg;base64,' + file, class:'previewImage'})

As I said, everything was ok on iOS 5 (where I initially tested). When I switched to iOS 4, the app crashed (actually all I saw was a blank screen) with no error at all!

[quote]WARNING: When setting the ‘class’ attribute, you must always use quotes![/quote]

After breaking down the code (I had around 400 lines of JS for that file) and trying different versions of Phonegap, I found out that… you kind of need to put attributes inside quotes!

So, after I replaced the above code with:

var preview = $('<img />').attr({"src" : 'data:image/jpeg;base64,' + file, "class":'previewImage'})

I saw the light: everything is working again!

Thank you Apple!

Îți vine să crezi sau nu, ce vezi mai jos este un… language picker:

Uite o idee la care să te gândești: în momentul în care faci un site multilimbi, ca să zic așa, acest feature îl adaugi pentru cei ce nu cunosc altă limbă decât cea maternă (și care, evident, este diferită de limba în care ai gândit tu site-ul).

Prin urmare, dacă pui un language picker pe un site, pune textul în limba targetată:

  • Română
  • English
  • etc..

Nu de alta, dar dacă englezul poate alege limba engleză, nu english, s-ar putea să… nu știe că înseamnă fix același lucru!

Am scris toată povestea asta când am văzut pe site-ul eventim.de că stau în „Rumänien”.

Just a quick note: if you have any troubles with Phonegap after you used:

<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=0.5, maximum-scale=0.5" />

in your app (that is, you don’t see the page like it should, instead you see everything zoomed in), you may want to add this into your PhoneGap.plist:

EnableViewportScale : YES

That’s all. Enjoy!

windows apple dropbox facebook twitter