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

Null safety (cherry-pick from upstream) #31

Merged
merged 7 commits into from
Oct 26, 2021
Merged

Conversation

m0nac0
Copy link
Collaborator

@m0nac0 m0nac0 commented Oct 20, 2021

Fixes #16

Switch to null safe (NNBD) mode, mostly cherry-picked and adapted from upstream (tobrun/flutter-mapbox-gl). Includes two more recent bug fixes from upstream that seem to be related.

m0nac0 and others added 4 commits October 20, 2021 09:30
Co-Authored-By: morvagergely <51244648+morvagergely@users.noreply.github.com>
It was crashing for me with the following error:
```
flutter/lib/ui/ui_dart_state.cc(209)] Unhandled Exception: type '_InternalLinkedHashMap<Object?, Object?>' is not a subtype of type 'Map<Object, Object>'
```

No reason to use <Object, Object> types instead of <dynamic, dynamic> as
used everywhere else
@m0nac0
Copy link
Collaborator Author

m0nac0 commented Oct 20, 2021

I haven't found any regressions, feedback and results of your manual testing are very welcome!

@kuhnroyal
Copy link
Collaborator

This is huge, I had a couple things laying around but didn't find the time to push it further. I will see if i can test this tomorrow.

@kuhnroyal
Copy link
Collaborator

I am running into fatal error: module 'Mapbox' not found in https://github.com/m0nac0/maplibre-annotation-extension/blob/master/MapboxAnnotationExtension/Annotations/MGLStyleAnnotation.h
Any idea what I can change in my setup?

@m0nac0
Copy link
Collaborator Author

m0nac0 commented Oct 21, 2021

Are you compiling the example app?

@m0nac0
Copy link
Collaborator Author

m0nac0 commented Oct 21, 2021

And have you run pod update, as the CI does? If I remember correctly, that was how @mindthefish solved this issue in #9.

@kuhnroyal
Copy link
Collaborator

Will, I am trying to use it in my app which is now possible due to the NNBD migration.
I am trying to mirror the example and added both pods to my Podfile, like in the example.
I also ran pod update which downloaded the git repos.

@m0nac0
Copy link
Collaborator Author

m0nac0 commented Oct 21, 2021

Are you also running pod update in the same folder as the CI? I unfortunately don't know that much about iOS development, but the error is exactly the same I was seeing before #9 was merged.

@kuhnroyal
Copy link
Collaborator

Hmm somehow the Mapbox framework is still in there, don't think this is something that we want.

@kuhnroyal
Copy link
Collaborator

Ok, I am starting to understand this a little better. Managed to get it to work on this branch. Looking good so far.

@m0nac0
Copy link
Collaborator Author

m0nac0 commented Oct 22, 2021

May I ask what you did to solve this?

A wild guess: could this file https://github.com/m0nac0/maplibre-annotation-extension/blob/master/Podfile.lock be the reason the Mapbox SDK is/was wrongfully loaded?

@kuhnroyal
Copy link
Collaborator

kuhnroyal commented Oct 22, 2021

There are 2 things that were confusing to me.

  1. The xcframework in MapLibre-native is still called Mapbox in 5.12.1 (I didn't see this before) - that is why the name change was reverted in m0nac0/maplibre-annotation-extension@0a24c3a
  2. Due to the Git dependency in the Podfile you always need to run pod update AND afterwards pod install or it won't work

And yes I am wondering the same, not sure if the Podfile.lock should even be committed there.

@mindthefish
Copy link

There are 2 things that were confusing to me.

  1. The xcframework in MapLibre-native is still called Mapbox in 5.12.1 (I didn't see this before) - that is why the name change was reverted in m0nac0/maplibre-annotation-extension@0a24c3a
  2. Due to the Git dependency in the Podfile you always need to run pod update AND afterwards pod install or it won't work

And yes I am wondering the same, not sure if the Podfile.lock should even be committed there.

Yes, pod install has to be executed after pod update, although the output says it is running pod install after update automatically.
Regarding the Podfile.lock: Is it best practice to leave it out of the repository?

@kuhnroyal
Copy link
Collaborator

Hmm I don't think it matters, the Podfile should only be used for the example app in that repo. We are only interest in the .podspec when using it as dependency.

@mindthefish
Copy link

I was able to run the examples of that branch on an iPad Pro running iOS 14.7.1 and will test on 15.0.2 on Monday. Not done with the review though.

@mindthefish
Copy link

mindthefish commented Oct 25, 2021

Able to compile and run on iPadOS 15.0.2. Crashes when I want to download offline maps.

Region download progress 0.0
libc++abi: terminating with uncaught exception of type std::__1::regex_error
* thread #27, name = 'com.mapbox.mbgl.DatabaseFileSource', stop reason = signal SIGABRT
    frame #0: 0x00000001bb8e79c4 libsystem_kernel.dylib`__pthread_kill + 8
libsystem_kernel.dylib`__pthread_kill:
->  0x1bb8e79c4 <+8>:  b.lo   0x1bb8e79e4               ; <+40>
    0x1bb8e79c8 <+12>: pacibsp
    0x1bb8e79cc <+16>: stp    x29, x30, [sp, #-0x10]!
    0x1bb8e79d0 <+20>: mov    x29, sp
Target 0: (Runner) stopped.
Lost connection to device.
Exited (sigterm)

@m0nac0
Copy link
Collaborator Author

m0nac0 commented Oct 25, 2021

@mindthefish Have you checked whether that crash also happens before this PR?

@mindthefish
Copy link

mindthefish commented Oct 25, 2021

Just tested, yes, it also happens on main. It is not caused by this PR.

@m0nac0
Copy link
Collaborator Author

m0nac0 commented Oct 25, 2021

Thank you for testing, would you mind opening a separate issue for the crash then?

@m0nac0
Copy link
Collaborator Author

m0nac0 commented Oct 25, 2021

Would anyone like to give more feedback on this? Otherwise I'd merge this.

@m0nac0 m0nac0 merged commit 2a37ff7 into main Oct 26, 2021
@m0nac0 m0nac0 deleted the m0-cp-607-null-safety branch October 26, 2021 11:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add null safety (NNBD) support
5 participants