如何修复 Meteor/Cordova iOS 应用程序的 waitForSyncReply 超时问题?
How to fix waitForSyncReply time-out with Meteor/Cordova iOS app?
我们有一个 Meteor/Cordova 应用程序。开发工作正常,除非部署到实际的 iPhone 设备。通常情况下,应用程序会在几次操作后冻结,导致 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
我发现它与信标功能有关。如果我注释掉以下代码,则不会发生冻结。
cordova.plugins.locationManager.startRangingBeaconsInRegion(beaconRegion)
.fail(console.error)
.done();
我会继续调查。但如果有人有什么好主意,我很乐意听听!
此致,
克里斯
显然,98 个信标的范围实在是太多了,至少考虑到 Cordova 应用程序中 JavaScript 回调的开销。问题是为每个信标调用了 startRangingBeaconsInRegion。我们将其更改为为每个 UUID(其中只有 2 个)调用它。整个应用现在感觉更加流畅和响应迅速!
所以我们替换这个:
var beaconRegion = new cordova.plugins.locationManager.BeaconRegion(beacon._id,
beacon.uuid,
beacon.major,
beacon.minor);
cordova.plugins.locationManager.startRangingBeaconsInRegion(beaconRegion)
.fail(console.error)
.done();
有了这个:
var beaconRegion = new cordova.plugins.locationManager.BeaconRegion('museumexplorerbeacon_' + uuid,
uuid);
cordova.plugins.locationManager.startRangingBeaconsInRegion(beaconRegion)
.fail(console.error)
.done();
根据这个WebKit Bugzilla
,可能是WebKit的隐藏bug
我们有一个 Meteor/Cordova 应用程序。开发工作正常,除非部署到实际的 iPhone 设备。通常情况下,应用程序会在几次操作后冻结,导致 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
我发现它与信标功能有关。如果我注释掉以下代码,则不会发生冻结。
cordova.plugins.locationManager.startRangingBeaconsInRegion(beaconRegion)
.fail(console.error)
.done();
我会继续调查。但如果有人有什么好主意,我很乐意听听!
此致, 克里斯
显然,98 个信标的范围实在是太多了,至少考虑到 Cordova 应用程序中 JavaScript 回调的开销。问题是为每个信标调用了 startRangingBeaconsInRegion。我们将其更改为为每个 UUID(其中只有 2 个)调用它。整个应用现在感觉更加流畅和响应迅速!
所以我们替换这个:
var beaconRegion = new cordova.plugins.locationManager.BeaconRegion(beacon._id,
beacon.uuid,
beacon.major,
beacon.minor);
cordova.plugins.locationManager.startRangingBeaconsInRegion(beaconRegion)
.fail(console.error)
.done();
有了这个:
var beaconRegion = new cordova.plugins.locationManager.BeaconRegion('museumexplorerbeacon_' + uuid,
uuid);
cordova.plugins.locationManager.startRangingBeaconsInRegion(beaconRegion)
.fail(console.error)
.done();
根据这个WebKit Bugzilla
,可能是WebKit的隐藏bug