Skip to content
This repository has been archived by the owner on Apr 10, 2024. It is now read-only.

Map not showing on iOS but on Android #16

Closed
gtu-myowin opened this issue Apr 13, 2022 · 17 comments
Closed

Map not showing on iOS but on Android #16

gtu-myowin opened this issue Apr 13, 2022 · 17 comments
Labels
state:unclear This issue needs further clarification type:bug This is a bug that needs to be fixed

Comments

@gtu-myowin
Copy link

Describe the bug
The map picker isn't show on iOS. It only shows circular progress indicator. No error was shown in "Debug Console" either. It is working fine on Android and I see no issue so far.

To Reproduce

  1. Install the package
  2. Try the sample "Basic Usage" code given in package's read me section.

Screenshots
Simulator Screen Shot - iPhone 13 Pro Max - 2022-04-13 at 23 25 18

Flutter Doctor -v
[✓] Flutter (Channel stable, 2.10.4, on macOS 12.3.1 21E258 darwin-x64, locale en-US)
• Flutter version 2.10.4 at /Users/name/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision c860cba910 (3 weeks ago), 2022-03-25 00:23:12 -0500
• Engine revision 57d3bac3dd
• Dart version 2.16.2
• DevTools version 2.9.2

[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
• Android SDK at /Users/name/Library/Android/sdk
• Platform android-32, build-tools 31.0.0
• ANDROID_HOME = /Users/name/Library/Android/sdk
• ANDROID_SDK_ROOT = /Users/name/Library/Android/sdk
• Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 11.0.11+0-b60-7590822)
• All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 13.3.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• CocoaPods version 1.11.2

[✓] Android Studio (version 2021.1)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 11.0.11+0-b60-7590822)

[✓] VS Code (version 1.66.1)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.38.1

[✓] Connected device (1 available)
• iPhone 13 Pro Max (mobile) • A5BDFA37-0233-4A71-9EC8-EBE70276CE35 • ios • com.apple.CoreSimulator.SimRuntime.iOS-15-4 (simulator)

[✓] HTTP Host Availability
• All required HTTP hosts are available

• No issues found!

@gtu-myowin
Copy link
Author

Turns out, the issue is only on simulator. The map works fine on real device. Even on simulator, disabling "useCurrentLocation" would makes it work like mentioned in this comment fysoul17#43 (comment)

@martin-braun
Copy link
Member

martin-braun commented Apr 16, 2022

I will later test on the Simulator with userCurrentLocation being true, but this really has little priority if it only affects Simulators.

@gtu-myowin
Copy link
Author

No problem! It's only a matter of time to find the solution ;)

@martin-braun
Copy link
Member

martin-braun commented Apr 21, 2022

@gtu-myowin I tried to reproduce it using the example project. Please clone this repository and confirm the issue this way. All I did was running the example project in the iPhone 13 Pro Max Simulator. On launch you have to give permission for location services. Does it ask you for permissions?

2022-04-21 2 54 20 AM

The linked comment fysoul17#43 (comment) was addressed and fixed by #8, it should not happen anymore. So does the map load just slow or does it not load after all?

I suspect this to be rather a network issue, but I am not sure. It is really crucial that you clone this project and test the case on the example project to rule out any extern circumstances like other packages, etc.

Thanks!

@martin-braun martin-braun reopened this Apr 21, 2022
@martin-braun martin-braun added state:unclear This issue needs further clarification type:bug This is a bug that needs to be fixed labels Apr 21, 2022
@gtu-myowin
Copy link
Author

@martin-braun Thank you for your fast replies. This is exactly why I chose your version of this package.

Sorry for late reply because I didn't get new notifications for new replies. I have cloned and try to run it on simulator and emulator but I got following errors on both and the app won't run.

Screen Shot 2022-04-22 at 10 13 30 PM

Screen Shot 2022-04-22 at 10 14 05 PM

@martin-braun
Copy link
Member

martin-braun commented Apr 22, 2022

@gtu-myowin You are very much welcome my friend. :)

Regarding the issue: Have you done the preparation steps described in the README of the example project?

Without it you will have missing files. You have to supply your own Google Maps API keys in the project by copying the .example files and editing the copied files.

Don't mind the "Android embedding v2" message, it should be a false message resulting in the fact that the AndroidManifest.xml is missing, I've addressed such migration already. Apart from that, you are about to test on the iPhone Simulator anyways, but it should fix itself when you prepare the files properly anyways.

@gtu-myowin
Copy link
Author

gtu-myowin commented Apr 23, 2022

Yes, I did add my own android & iOS key in keys.dart which was renamed from keys.dart.example. I do not mind the embedding error but the app won't run. I think it is because of version 2.0.0-mb.16. I updated your package in my project as mentioned in https://github.com/martin-braun/google_maps_place_picker_mb/issues/17#issuecomment-1104568750 and the app won't run anymore too. I reverted the update and it runs again.

@martin-braun
Copy link
Member

@gtu-myowin Did you also create the AndroidManifest.xml and AppDelegate.swift? Your output literally said it's missing the AndroidManifest.xml. It's three files in total that need to be created.

I reverted the update and it runs again.

I have trouble to get that, because things work on my end with 2.0.0-mb.16.

No matter which version you launch (15 or 16), is the map loading in the iPhone Simulator, please?

@gtu-myowin
Copy link
Author

Sorry, I didn't realized that there were two more .example file there. Now I can run the app but Load Google Map in Container doesn't work with or without useCurrentLocation: true. By doesn't work, I mean it is endlessly show the CircularProgressIndicator.

Load Google Map works without useCurrentLocation: true but not with that enabled as mentioned in original thread. But even with useCurrentLocation: true commented out or disabled, the map isn't loading but I can choose the location. See below

Simulator Screen Shot - iPhone 13 Pro Max - 2022-04-25 at 12 40 11

Yes, it did asked me for location permission and I have allowed while using the app. I have tried with and without 1.1.1.1 VPN as well. I got no log in both vscode and xcode. I am not sure what was wrong.

It's ok! I can still use the version 15 and I think you should wait for another similar issue because this could be specific to my device or network.

@martin-braun
Copy link
Member

@gtu-myowin Thank you for testing. Can you share the output of the console? The Google Maps API might report some issues here we can learn about.

Thanks in advance.

@gtu-myowin
Copy link
Author

As I mentioned I got no log in both vscode and xcode as well. Not even a warning message.

@martin-braun
Copy link
Member

@gtu-myowin When I debug from VSCode and tap on "Load Google Map" I get this in the Debug Console of VSCode:

Launching lib/main.dart on Pixel 3a in debug mode...
lib/main.dart:1

✓  Built build/app/outputs/flutter-apk/app-debug.apk.
D/FlutterGeolocator(28743): Creating service.
D/FlutterGeolocator(28743): Binding to location service.
D/FlutterLocationService(28743): Creating service.
D/FlutterLocationService(28743): Binding to location service.
Connecting to VM Service at ws://127.0.0.1:58816/HGiE9ouH4FE=/ws
I/Gralloc4(28743): mapper 4.x is not supported
W/Gralloc3(28743): mapper 3.x is not supported
W/Gralloc4(28743): allocator 4.x is not supported
W/Gralloc3(28743): allocator 3.x is not supported
D/MapsInitializer(28743): preferredRenderer: null
D/zzca    (28743): preferredRenderer: null
I/zzca    (28743): Making Creator dynamically
I/DynamiteModule(28743): Considering local module com.google.android.gms.maps_dynamite:0 and remote module com.google.android.gms.maps_dynamite:203115000
I/DynamiteModule(28743): Selected remote version of com.google.android.gms.maps_dynamite, version >= 203115000
V/DynamiteModule(28743): Dynamite loader version >= 2, using loadModule2NoCrashUtils
I/Google Maps Android API(28743): Google Play services client version: 12451000

By saying "no log" you mean there is no more output after ✓ Built build/app/outputs/flutter-apk/app-debug.apk.?

@gtu-myowin
Copy link
Author

By no log I mean, when loading the map. But since you are talking about full log, here is the xcode log

2022-04-29 10:38:34.682137+0630 Runner[35486:3651450] Metal GPU Frame Capture Enabled
2022-04-29 10:38:34.682390+0630 Runner[35486:3651450] Metal API Validation Enabled
2022-04-29 10:38:34.963224+0630 Runner[35486:3652352] flutter: Observatory listening on http://127.0.0.1:58322/Wvr19Vdzv54=/
2022-04-29 10:39:18.534724+0630 Runner[35486:3651450] [HardwareKeyboard] -[UIApplication getKeyboardDevicePropertiesForSenderID:shouldUpdate:usingSyntheticEvent:], failed to fetch device property for senderID (778835616971358211) use primary keyboard info instead.
2022-04-29 10:39:18.540736+0630 Runner[35486:3651450] [HardwareKeyboard] -[UIApplication getKeyboardDevicePropertiesForSenderID:shouldUpdate:usingSyntheticEvent:], failed to fetch device property for senderID (778835616971358211) use primary keyboard info instead.
objc[35486]: Class _PathPoint is implemented in both /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/UIKitCore.framework/UIKitCore (0x113e64650) and /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/TextInputUI.framework/TextInputUI (0x144405690). One of the two will be used. Which one is undefined.
objc[35486]: Class _PointQueue is implemented in both /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/UIKitCore.framework/UIKitCore (0x113e64628) and /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/TextInputUI.framework/TextInputUI (0x1444056b8). One of the two will be used. Which one is undefined.
2022-04-29 10:39:20.014897+0630 Runner[35486:3651450] LOCATION UPDATE FAILURE:Error reason: (null)Error description: The operation couldn’t be completed. (kCLErrorDomain error 0.)

And here is the vscode log. The simulator looks like this on both vscode and xcode when loading the map

Screen Shot 2022-04-29 at 10 42 34 AM

@martin-braun
Copy link
Member

martin-braun commented May 1, 2022

@gtu-myowin Thanks. You see, this is why sharing logs is so important. And indeed, those Xcode logs are really what was necessary to track down the issue.

LOCATION UPDATE FAILURE:Error reason: (null)Error description: The operation couldn’t be completed. (kCLErrorDomain error 0.)

This is really the coffin here. The geolocator is raising an internal error that cannot be caught, so it will jump out of the code, so the rendering of the map is never reached.

try {
  permissionGranted = await location.requestPermission();
  if (permissionGranted == LocationPlatformInterface.PermissionStatus.granted) {
    currentPosition = await Geolocator.getCurrentPosition(
      desiredAccuracy: desiredAccuracy ?? LocationAccuracy.best
    ); // crash, but no exception
  } else {
    currentPosition = null;
  }
} catch (e) {
  print(e);
  currentPosition = null;
}

I searched for the message to find out that the issue has been reported at Baseflow/flutter-geolocator#190 and I you can fix this issue by selecting a location in your Simulator:

Screen Shot 2022-05-02 at 12 10 36 AM

I just switched it to none and now I experience the same problems. It would be helpful if this could be caught instead of it crashing. I don't know if this case can ever occur on a real device.

I contacted the author of geolocator to see how I can catch it properly.

@martin-braun martin-braun removed the state:unclear This issue needs further clarification label May 1, 2022
@gtu-myowin
Copy link
Author

Hi @martin-braun, thank you for your researches. I really appreciate it! I tried enabling custom location in Simualtor and yes, the loading indicator disappear but the map is still like in this https://github.com/martin-braun/google_maps_place_picker_mb/issues/16#issuecomment-1108123614. It's blank!

I think you can just add it in read me section so that people would know it is because of the simulator.

@martin-braun martin-braun added the state:unclear This issue needs further clarification label May 4, 2022
@martin-braun
Copy link
Member

martin-braun commented May 4, 2022

@gtu-myowin And I thank you for helping to investigate this issue, even when it has low priority. You say the example works on version 2.0.0-mb15, but not on 2.0.0-mb16. So if you download mb15 the example app within it should work.

Then you could slowly add the changes I made towards mb16 and see on what point it broke. It really makes no sense to me and here is why:

  • I added FVM support. It's really not relevant, because those files will be ignored if you don't use FVM.
  • I updated CocoaPods, but I did not update any packages, so except for the version number, pubspec.yaml matches
  • I added that one event that triggers when the map type changes, so this code will never be reached when the map cannot display
  • I removed an unused import

I'm really baffled and despite this being lower priority, I would really be interested to understand why you have such issues.

I think you can just add it in read me section so that people would know it is because of the simulator.

Later, I will definitely update the README.md, especially since it breaks anywhere when no location is set in the Simulator.

@martin-braun
Copy link
Member

All I can do now, since my hands are tied and I cannot reproduce any further issues regarding this. After all this is a Simulator-only issue at best. Thank you.

@martin-braun martin-braun closed this as not planned Won't fix, can't repro, duplicate, stale Jun 27, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
state:unclear This issue needs further clarification type:bug This is a bug that needs to be fixed
Projects
None yet
Development

No branches or pull requests

2 participants