RealHandy
RealHandy

Reputation: 602

iOS Meteor Cordova app: all app graphics disappear after a few minutes

I've got a working Meteor Cordova app that installs and runs on both iOS and Android devices. However, on iOS only, and only if the iPhone is not plugged into xCode, all of the graphic assets disappear from the app and show as nothing -- no broken pic image or box outline or different color, just the color of the background as though nothing was ever there. They don't disappear while you stare at the current screen, you have to go to a different screen or leave and return to the app, but once it happens, all the graphics are gone. It doesn't even affect formatting of page content. Just poof, no more graphics.

Since it's on-device only and doesn't happen if plugged into xCode, I haven't been able to get any possible error messages. Plus, the app still works fine. And if I kill the app and restart it, the icons all come back.

Maybe this is a behavior of the internal web server that Cordova does to get around the WKWebView-no-local-assets issue? Maybe it's a code issue (I've had another iOS-only issue that was a string vs number thing in how iOS and Android act differently). But since I can only reproduce it on-device and without connection to debugging, I'm hoping someone knows the answer.

I keep all of my graphics in /public/images, if that's a clue. But the fact that it doesn't happen on Android is really a stumper.

UPDATE:

More info. I've used Xcode to examine the console log and found these log entries that clearly show the image resources are being successfully retrieved.

Jan 4 15:06:00 Andys-iPhone-7 com.apple.WebKit.Networking(CFNetwork)[6275] <Notice>: TIC TCP Conn Event [162:0x12bd42470]: 1 Err(0) Jan 4 15:06:00 Andys-iPhone-7 com.apple.WebKit.Networking(CFNetwork)[6275] <Notice>: TIC TCP Conn Connected [162:0x12bd42470]: Err(0) Jan 4 15:06:00 Andys-iPhone-7 com.apple.WebKit.Networking(CFNetwork)[6275] <Notice>: TIC TCP Conn Cancel [162:0x12bd42470] Jan 4 15:06:00 Andys-iPhone-7 com.apple.WebKit.Networking(CFNetwork)[6275] <Notice>: TIC TCP Conn Destroyed [162:0x12bd42470] Jan 4 15:06:00 Andys-iPhone-7 com.apple.WebKit.WebContent(WebKit)[6276] <Notice>: 0x10e2f1148 - WebResourceLoader::didReceiveResponse: (pageID = 2, frameID = 1, resourceID = 239, status = 200) Jan 4 15:06:00 Andys-iPhone-7 com.apple.WebKit.WebContent(WebKit)[6276] <Notice>: 0x10e2f1148 - WebResourceLoader::didReceiveData: Started receiving data (pageID = 2, frameID = 1, resourceID = 239) Jan 4 15:06:00 Andys-iPhone-7 com.apple.WebKit.WebContent(WebKit)[6276] <Notice>: 0x10e2f1148 - WebResourceLoader::didFinishResourceLoad: (pageID = 2, frameID = 1, resourceID = 239)

but then when the problem occurs, the log is this:

Jan 4 14:31:00 Andys-iPhone-7 com.apple.WebKit.Networking(CFNetwork)[6252] <Notice>: TIC TCP Conn Event [141:0x159e0d9f0]: 3 Err(61) Jan 4 14:31:00 Andys-iPhone-7 com.apple.WebKit.Networking(CFNetwork)[6252] <Error>: TIC TCP Conn Failed [141:0x159e0d9f0]: 1:61 Err(61) Jan 4 14:31:00 Andys-iPhone-7 com.apple.WebKit.Networking(CFNetwork)[6252] <Notice>: TIC TCP Conn Cancel [141:0x159e0d9f0] Jan 4 14:31:00 Andys-iPhone-7 com.apple.WebKit.Networking(CFNetwork)[6252] <Notice>: TIC TCP Conn Destroyed [141:0x159e0d9f0] Jan 4 14:31:00 Andys-iPhone-7 com.apple.WebKit.Networking(WebKit)[6252] <Notice>: 0x103184b40 - NetworkResourceLoader::start: Retrieving resource from cache (pageID = 2, frameID = 1, resourceID = 224, isMainResource = 0, isSynchronous = 0) Jan 4 14:31:00 Andys-iPhone-7 com.apple.WebKit.Networking(CFNetwork)[6252] <Error>: HTTP load failed (error code: -1004 [1:61])

The -1004 error is cannot connect to host. So, this app is successfully getting images from, I think, the internally existing content server, but that breaks after a few minutes.

Does anyone have any ideas? Meteor 1.6, newest xCode, iOS 10, btw. Thanks!

Upvotes: 1

Views: 244

Answers (1)

RealHandy
RealHandy

Reputation: 602

Found the answer on the Meteor forum. In writeups like this:
https://github.com/meteor/cordova-plugin-meteor-webapp/issues/27

it's confirmed that there are issues with the plugin that provides the embedded content server, and macrozone has provided a fix. Install this in your project:
meteor add cordova:cordova-plugin-meteor-webapp@https://github.com/panter/cordova-plugin-meteor-webapp.git#7bb095ce393d17f662cc6bb596ce91acf743d17a

This solves this issue and maybe some white screen of death meteor cordova issues, too. Kudos to macrozone!

Upvotes: 1

Related Questions