Build issue for ios in MGLModule.m Multiple Errors - MapLibre SDK
See original GitHub issueDescribe the bug
The IOS Build Process fails with multiple errors in MGLModule.m after adding react-native-mapbox lib and installing pods
To Reproduce
- npx react-native init MapTest
- yarn add @react-native-mapbox-gl/maps
- adjust podfile (like below)
- pod install
- open workspace file with XCode 12.5.1 and run build
Podfile:
require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
platform :ios, '10.0'
target 'MapTest' do
config = use_native_modules!
use_react_native!(
:path => config[:reactNativePath],
# to enable hermes on iOS, change `false` to `true` and then install pods
:hermes_enabled => false
)
target 'MapTestTests' do
inherit! :complete
# Pods for testing
end
$RNMBGL_Use_SPM = true
pre_install do |installer|
$RNMBGL.pre_install(installer)
end
# Enables Flipper.
#
# Note that if you have use_frameworks! enabled, Flipper will not work and
# you should disable the next line.
use_flipper!()
post_install do |installer|
react_native_post_install(installer)
$RNMBGL.post_install(installer)
end
end
Expected behavior
Build runs successfully
Actual behavior
Build fails with multiple errors in MGLModule.m
// style urls
NSMutableDictionary *styleURLS = [[NSMutableDictionary alloc] init];
[styleURLS setObject:[MGLStyle.streetsStyleURL absoluteString] forKey:@"Street"];
[styleURLS setObject:[MGLStyle.darkStyleURL absoluteString] forKey:@"Dark"];
[styleURLS setObject:[MGLStyle.lightStyleURL absoluteString] forKey:@"Light"];
[styleURLS setObject:[MGLStyle.outdoorsStyleURL absoluteString] forKey:@"Outdoors"];
[styleURLS setObject:[MGLStyle.satelliteStyleURL absoluteString] forKey:@"Satellite"];
[styleURLS setObject:[MGLStyle.satelliteStreetsStyleURL absoluteString] forKey:@"SatelliteStreet"];
....
RCT_EXPORT_METHOD(setAccessToken:(NSString *)accessToken)
{
[MGLAccountManager setAccessToken:accessToken];
}
Errors:
- Property ‘streetsStyleURL’ not found on object of type ‘MGLStyle’ (line 30-35)
- occurring for all attributes of MGLStyle object
- Use of undeclared identifier ‘MGLAccountManager’ (line 243+258)
Versions (please complete the following information):
- Platform: iOS
- Platform OS: iOS 10
- Device: IPhone 12 mini
- Emulator/ Simulator: yes
- Dev OS: OSX 11.4
- react-native-mapbox-gl Version 8.2.1
- Mapbox GL version 5.9.0
- React Native Version 0.63.4
Additional context
Build run on XCode 12.5.1
Issue Analytics
- State:
- Created 2 years ago
- Reactions:3
- Comments:32 (12 by maintainers)
Top Results From Across the Web
Common crash referencing ...
I am using this library through react-native-mapbox-gl. Since switching the base library from mapbox-gl-native, I am seeing a huge increase ...
Read more >Troubleshooting Mapbox Maps and Navigation SDKs for iOS ...
Learn how to troubleshoot issues when installing the Mapbox Maps or Navigation SDK for iOS with Swift Package Manager, CocoaPods, and Carthage.
Read more >Mapbox Maps SDK for iOS
The Mapbox Maps SDK for iOS is an open-source framework for embedding interactive map views with scalable, customizable vector maps into Cocoa Touch ......
Read more >ld: building for iOS Simulator, bu… | Apple Developer Forums
Hi! Running Xcode 12.5 using Rosetta 2 on simulator with iOS 14.5, and I get the following error: ld: building for iOS Simulator,...
Read more >Using the MapLibre GL Native SDK for iOS with Amazon ...
The MapLibre GL Native SDK for iOS is a library based on Mapbox GL Native , and is compatible with the styles and...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Can everyone observing this issue let me know which version is actually downloaded and used in
XCode
>PROJECT
>Swift Packages
??My suspicion is, that it actually downloads version
5.12.0
of MapLibre, because these are the requirements that are used when nothing specific is defined (and you aren’t onmaster
):You can circumvent this by adding this to your
Podfile
:Make sure to previously remove the current swift package download in XCode, just to be sure. 👍🏿
@jutaz, reason why it probably works in Android is, that it doesn’t use something like this
upToNextMajorVersion
. Could you try withandroid-v9.5.0
and report back please if you find the time? Thanks in advance 🙇🏿FWIW this works beautifully on Android w/ Maplibre and the same versions of packages. So it seems like something is off w/ iOS