fastlane-community / fastlane-plugin-cordova_screenshots

Take screenshots of your Cordova/Ionic app with fastlane
MIT License
17 stars 10 forks source link

Ionic apps fail with "Error Unable to load app" #23

Open danroot opened 5 years ago

danroot commented 5 years ago

I followed the instructions and some issues (switch to Swift 5, update SnapshotHelper) to get this set up. I was able to run fastlane screenshots and it worked for half of the shots, but failed with a screenshot of "Error Unable to load app" for about half of them. Looking up this error I found it can happen if multiple instances run concurrently as that can cause contention for the port ionic uses to serve up the web content.

From that, I found that adding concurrent_simulators(false) to my Snapfile (or, I would suspect using the corresponding CLI parameter or option in Fastfile) fixed this issue.

I'm actually not sure if this is an Ionic or Cordova issue, but regardless I hope this helps someone and it may be worth adding to the documentation.

janpio commented 5 years ago

Can you share a screenshot of the error you got? That might enable me to pinpoint the problem a bit.

danroot commented 5 years ago

To be clear, the error is in the ionic or cordova app, not in this plugin per se. If you don't have any asserts or navigation and are just screenshotting the ionic app's launch page, and you have the default concurrent_simulators=true, and you have multiple devices, then you will get this error for some screenshots. I think this is port contention in the ionic app, though I'm a little fuzzy on how that works. In my case concurrent_simulators(false) in the Snapfile (or equivalent) is a fine fix. I'm just thinking it may be worth documenting, or at least having in this issue thread for a month from now when I forget ;)

iPhone 7 Plus-app-launch

janpio commented 5 years ago

Yeah, that definitely looks like something inside the app is failing - never seen that before. What webview (plugin name and version) is your app using?

danroot commented 5 years ago

This is cordova-plugin-ionic-webview, but an older version. It looks like I need to update and try concurrent_simulators:true with that. Will update this issue once I get a chance to do that.