NadavRub
NadavRub

Reputation: 2610

PhoneGAP, iOS, 'getFile' callback doesn't invoke JavaScript Callback

Environment

Code snippet

document.addEventListener('deviceready', function () {
  window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, function (fileSystem) {
    fileSystem.root.getFile("state.json", {}, success, faliure);
  });
});

With the above code

  1. 'deviceready' is invoked.
  2. 'requestFileSystem' callback is successfully invoked.
  3. 'fileSystem.root.getFile' NEVER calls back ( neither SUCCESS or FAILURE ).

Problem description

  1. Tracing through with xcode @ CDVFile.m it is clear that although sendPluginResult is SUCCESSFULY called, the JavaScript method is not being executed.
  2. Pressing the home button to put the app in the background and re-activating it makes the above flow work
  3. On the iPhone simulator this problem CANNOT be produced
  4. Extending and collapsing the notification pane also cause the JScript callback to get executed

What may cause this problem?

What might be wrong with the above mentioned use-case?

Any help will be appreciated

Upvotes: 3

Views: 947

Answers (2)

Geo G
Geo G

Reputation: 345

Hey I was experiencing this same issue, but with what I think is a different root cause. I wrote up the solution here:

https://groups.google.com/d/msg/phonegap/skiqf9wQCbY/5UuyCz1cSwAJ

small correction to the above here:

https://groups.google.com/d/msg/phonegap/skiqf9wQCbY/jq5pJbwMFS8J

Just wanted to post here for everyone's benefit.

Upvotes: 1

NadavRub
NadavRub

Reputation: 2610

The above mentioned is a side affect of specifying a section having ~invalid~ js file name, it appears that name resolution is case sensitive for Safari @ iOS ( in contrast to some Desktop browsers ), I have found the following link really helpful in pinpointing this. http://www.mobilexweb.com/blog/iphone-5-ios-6-html5-developers ( new JScript debugging feature in specific )

Upvotes: 2

Related Questions