且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何调试流星/ cordova应用程序使用铁路由卡在加载屏幕?

更新时间:2023-08-20 09:58:52

This looks very much like a connectivity problem. First thing to try in the console:

Router.current().ready()

If this doesn't return false then there is something very funny going on with Tracker or Iron-Router, as it (reactively) gives the master wait-list readiness, so if it returns true then there is something else preventing the page from rendering.

The best way to find out which item(s) in the wait-list isn't ready is to go through your Router code, pull out the subscription handles into a global object, and pass references to the waitOn callback.

For example, rather than:

waitOn: function() {
    return [Meteor.subscribe('someThings'), Meteor.subscribe('someOtherThings')];
}

do this instead:

Subs = {};

waitOn: function() {
    Subs.someThings = Meteor.subscribe('someThings');
    Subs.someOtherThings = Meteor.subscribe('someOtherThings');
    return [Subs.someThings, Subs.someOtherThings];
}

That way, you can run Subs.someThings.ready() from the console on each of the subscriptions to find out which it is that is preventing your page from rendering. Hopefully, this is a start.

However, whilst I don't fully understand the error messages you've posted, the fact that it's got "FAILED TO LOAD RESOURCE" strongly suggests a connection issue, which would prevent subscription data making its way to your client via DDP and thus prevent the subscription returning ready. I would have a look in the Network tab to see what's going on (or not doing) there.

Apologies that this isn't a solution, but hopefully it's a start. If it is connectivity, check all the things in here - i.e. Developer tools enabled, USB debugging allowed, Android device connected to the same wifi, IP correct...

UPDATE: Thinking about this a little more, the app is installed via USB debugging, so the fact that you can run it at all indicates that there isn't a problem there. However, I assume the data is passed over the local network, which is where the problem is, so I think it must be that the two devices are not connected to the same wifi, or else the supplied IP is incorrect.