Domanda

When loading some ajax via the PebbleKit JavaScript framework the app crashes, I can see via console.log() that the XMLHttpRequest.open() is called ok, but it doesn't get pass XMLHttpRequest.send().

I have had previous similar code working fine, but I have been unable to debug this issue.

It does not fire the onload event, nor timeout (at not that I can tell via console.log().

All I see in the pebble console is:

[ERROR ] Lost connection to Pebble

Looking at the composed url it does not appear to be malformed, and it loads ok in a desktop browser.

È stato utile?

Soluzione

I can see via the iOS console (in xcode organiser), the error:

PebbleApp[211] : * Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '* -[NSURL URLByAppendingPathComponent:]: component, components, or pathExtension cannot be nil.'

Digging deeper in I can see that one of the querystring elements simply had a space at the end. Removing the space solved the problem, so I can assume that it was due to it not being properly URLEncoded.

I would of thought that this would typically be handled fine by JavaScript running in mobile webkit, but I'm guessing as it's embedded into an app, it is stricter and threw a exception.

Notably this is in beta 2 of the 2.0 sdk, so it may already be easier to diagnose in later versions.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top