Chris
Chris

Reputation: 2463

How to fix waitForSyncReply time-out with Meteor/Cordova iOS app?

We have a Meteor/Cordova app. Development works fine, except when deploying to an actual iPhone device. More often than not the app freezes after a couple of actions, resulting in the following logs in XCode:

2016-12-15 13:12:43.546614 museumexplorer[738:169260] #WK: Connection::waitForSyncReply: Timed-out while waiting for reply, id = 35
2016-12-15 13:12:44.554481 museumexplorer[738:169260] #WK: Connection::waitForSyncReply: Timed-out while waiting for reply, id = 36
2016-12-15 13:12:45.559667 museumexplorer[738:169260] #WK: Connection::waitForSyncReply: Timed-out while waiting for reply, id = 37
2016-12-15 13:13:06.239664 museumexplorer[738:169260] #WK: Connection::waitForSyncReply: Timed-out while waiting for reply, id = 38
2016-12-15 13:13:07.248334 museumexplorer[738:169260] #WK: Connection::waitForSyncReply: Timed-out while waiting for reply, id = 39
2016-12-15 13:13:08.260760 museumexplorer[738:169260] #WK: Connection::waitForSyncReply: Timed-out while waiting for reply, id = 40

I found it has something to do with the beacons functionality. If I comment out the following code, the freezes don't occur.

cordova.plugins.locationManager.startRangingBeaconsInRegion(beaconRegion)
    .fail(console.error)
    .done();

I'll keep investigating. But if anyone has any bright ideas, I'd love to hear it!

Regards, Chris

Upvotes: 2

Views: 4089

Answers (2)

wzso
wzso

Reputation: 3905

It might be a hidden bug in WebKit, according to this WebKit Bugzilla

Upvotes: 0

Chris
Chris

Reputation: 2463

Apparently ranging 98 beacons is simply too much, at least with the overhead of the JavaScript callback in a Cordova app. The issue was that startRangingBeaconsInRegion was called for each beacon. We changed it to calling it for each UUID (of which there are only 2). The entire app feels more fluid and responsive now!

So we replace this:

var beaconRegion = new cordova.plugins.locationManager.BeaconRegion(beacon._id,
    beacon.uuid,
    beacon.major,
    beacon.minor);

cordova.plugins.locationManager.startRangingBeaconsInRegion(beaconRegion)
    .fail(console.error)
    .done();

With this:

var beaconRegion = new cordova.plugins.locationManager.BeaconRegion('museumexplorerbeacon_' + uuid,
    uuid);

cordova.plugins.locationManager.startRangingBeaconsInRegion(beaconRegion)
    .fail(console.error)
    .done();

Upvotes: 1

Related Questions