Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iOS: Google Maps views are not captured #93

Closed
sperochon opened this issue Aug 13, 2019 · 2 comments
Closed

iOS: Google Maps views are not captured #93

sperochon opened this issue Aug 13, 2019 · 2 comments
Labels
good first issue Good for newcomers waiting for response Issue addressed, response anticipated

Comments

@sperochon
Copy link

sperochon commented Aug 13, 2019

Hello Maurice,

First, thank you for all your work in your Flutter packages!

I’m a dev too and using your screenshots package saved my day… my week rather ;-) (Had to generate 300 screenshots / per platform…)

Everything works fine, except in this case:

My app use google maps view
https://pub.dev/packages/google_maps_flutter

and the map is not being captured in the screenshot = it’s empty
It happens only on iOS.

Made with screenshots package
iPhone 8 Plus-screenshot_5_maps

Made manually
Simulator Screen Shot - iPhone Xs Max - 2019-08-13 at 11 51 51

Thanks!

@mmcc007 mmcc007 added the good first issue Good for newcomers label Aug 13, 2019
@mmcc007
Copy link
Owner

mmcc007 commented Aug 13, 2019

Glad you were able to make such good use of screenshots. 600 screenshots, that's impressive!

screenshots calls

final pixels = await driver.screenshot();

which, in flutter drive, calls
https://github.com/flutter/flutter/blob/aa83b284a45497330577ec51b12472b0c92104a6/packages/flutter_driver/lib/src/driver/driver.dart#L849
which, via the observatory and the flutter engine
https://github.com/flutter/engine/blob/7711efbf062a77f28deac68716f808fba071803a/runtime/service_protocol.cc#L23
ends up talking to the dart VM to get the current screen image.

Based on the flutter engine architecture:
https://github.com/flutter/flutter/wiki/The-Engine-architecture
my guess is that the Google Maps plugin interacts/behaves differently before rendering on iOS and Android and consequently screen capture behaves differently.

It might be worth experimenting with inserting a delay before the screenshot call to allow more time for the screen image to render on iOS.

Since the Google Maps plugin is still in developer preview, and if this issue cannot be resolved, it might be worth opening an issue for the plugin.

Let's see how it goes.

@mmcc007 mmcc007 added the waiting for response Issue addressed, response anticipated label Aug 15, 2019
@mmcc007 mmcc007 closed this as completed Aug 30, 2019
@tek08
Copy link

tek08 commented Jun 18, 2020

Am having same issue over here. Google Maps has since merged in [google_maps_flutter] Take snapshot of map #2607 to the maps plugin. That said, it doesn't link up to FlutterDriver's screenshot method. Been considering workarounds, including some clever image stitching. Any chance there's a less complicated way?

Edit:

My somewhat gross workaround:

ProcessResult result = await Process.run('xcrun', [
  'simctl',
  'io',
  'booted',
  'screenshot',
  '/tmp/screenshots/test/screenshot_maps.png'
]);

inside the test instead of await screenshot(...) if there's a google maps obj on screen.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers waiting for response Issue addressed, response anticipated
Projects
None yet
Development

No branches or pull requests

3 participants