Comments (25)
Thanks for the details. Has your RN Xcode project gone through RN version updates? I think this can explain the need for step 1 and 2 in your solution.
My next question was going to be around what version of cocoapods was being used. I should have asked that one first.
In regard to the issues that are still there - I can't solve that 1st issue yet unfortunately.
The 2nd issue you mention I should be able to implement that delegate method on the native side and provide a prop that accepts a callback function. Perhaps something like onNavigationFinish
that takes a function. I'll need to implement that on android and iOS.
I'm going to close this issue for now and I'll follow up when I release a new version with the prop for handling the navigation ending.
from react-native-mapbox-navigation.
I'm curious did you create a bridging header for swift or already have one? There is a step in the readme on how to do this if you haven't created one yet - https://github.com/homeeondemand/react-native-mapbox-navigation#ios-specific-instructions
from react-native-mapbox-navigation.
So, I have gotten this to work for me. In my case, I did need to have the Mapbox Libraries load dynamically. In order to achieve this, I needed to:
- add
use_frameworks!
to my podfile (this makes the libraries dynamic instead of static) - modify the podspecs in any libraries that reference
React
as a dependency in their podspec to instead depend onReact-Core
. In my case, this included:@react-native-community/masked-view
,amazon-cognito-identity-js
,react-native-gesture-handler
, and this library,@homee/react-native-mapbox-navigation
- I then brought in
patch-package
to create patch files that changes those for me as part of npm install
Note, our app uses the expo libraries (not build environment) which requires use_unimodules!
, and this still works. I did not need to remove the swift-5.0 toolchain for this to work, or setting any code stripping things.
from react-native-mapbox-navigation.
hey @rossmartin @mertozylmz yeah.. following steps solved the issue for me
- Go to project>build settings> library search path
- remove "$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)"
at this point i was able to run the app on simulator but not on device - after this I had to set
Don't Dead-strip Inits and Terms
toYes
for both Project and Target. - and most importantly update the cocoapods to
1.10.1
at this point i was also able to run the app on device
However, I am still seeing following issues which were not originally related to this issue
- seeing a random language issue on navigation view. I have tried following steps mentioned here : mapbox/mapbox-navigation-ios#2605 (comment) but no luck
- once the navigation finishes in the , nothing happens if you click on
End Navigation
button.
These two should be easily reproducible..thx
from react-native-mapbox-navigation.
Something interesting to note, when we pulled all the library source code into the project, we found everything works if it's marked as dynamically linked. Seems to be something related to the library being statically linked?
Relevant lines from our Podfile:
pod 'MapboxCoreNavigation', :build_type => :dynamic_framework
pod 'MapboxNavigation', :build_type => :dynamic_framework
from react-native-mapbox-navigation.
You appear to have a mac that is using apple silicon. The underlying SDK needs to be updated to handle this but until that happens you can get around it by adding this to your Podfile (ios/Podfile
) -
# define architecture at the top level of your Podfile
architecture = `uname -p` # arm64 or i386
target 'YourAppNameHere' do
# ... you will have all your stuff in between here
post_install do |installer|
flipper_post_install(installer)
## add this here after the above
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
if architecture === 'arm64' # only enable this for apple silicon
config.build_settings["ONLY_ACTIVE_ARCH"] = "YES"
end
end
end
end
end
from react-native-mapbox-navigation.
Thanks for looking into this. I have a 4 year old mac. arm64 could be attributed to me running this on an actual iphone device? But regardless let me try the podfile changes you suggested and report back.
from react-native-mapbox-navigation.
Hey glad you got it figured out for the simulator at least. I see that you received an answer in your stackoverflow post and hopefully that resolves it.
I have witnessed some odd behavior with language in the navigation UI as well. I believe it is related to this - mapbox/mapbox-navigation-ios#2605. I left a comment in that thread.
In the future I might add language prop and then set it on the native side. It should be using the language set by the device but I have witnessed some parts of the nav UI be different.
from react-native-mapbox-navigation.
Hey @nitinsh99 I added an onArrive
prop that gets called when you reach the destination. This is published in 0.2.2
.
I could not find a delegate/callback in the SDK that gets called when you tap the "End Navigation" in the bottom banner. Now you will know when you have arrived at the destination though.
from react-native-mapbox-navigation.
Thanks for providing the details. I haven’t had time until now to catch up on emails. I closed on the purchase of a house yesterday and I’ve been busy with that and starting to move. I’ll be swamped in the coming weeks but I’ll try to help when I can.
from react-native-mapbox-navigation.
@LowBudgetMan @devguy22 I had some time to revisit this stuff tonight. I spent too much time going down this rabbit hole with the root cause of the library being statically linked.
One thing I did do is publish 1.0.1
that changes the dependency of React
to React-Core
in the podspec (https://github.com/homeeondemand/react-native-mapbox-navigation/releases/tag/1.0.1).
If I get some more time I'll try and find a solution. Until cocoapods can incorporate dynamic swift pods then I may have to go the route that @LowBudgetMan mentions.
from react-native-mapbox-navigation.
Yeah. I had that configured. I was able to resolve this issue ONLY for emulator by removing $(toolchain dir)/usr/lib/swift-5.0/$(platform_name)
from my library search path. After I did that I am able to run the app on emulator. However, I am not able to run the app on real device as I am getting some un-related errors.
Here is the stackoverlow I created: https://stackoverflow.com/questions/66079852/xcode-react-native-undefined-symbol-swift-getfunctionreplacement which has more details.
Feel free to close this issue but I do have one last question for you. I am seeing the lanugage as chinese
in the navigation view? Any idea how I can make it default to english
? I don't see any language related prop.Thx
from react-native-mapbox-navigation.
Hi @rossmartin , I did what they said, but the error still continues.
I'm getting the same mistake with @nitinsh99. Can you help me?
from react-native-mapbox-navigation.
@nitinsh99 @mertozylmz What version of cocoapods are you using? I can't reproduce the issue with Xcode 12.4 and cocoapods 1.10.1
@mccooll Can you elaborate on the negativity?
from react-native-mapbox-navigation.
@nitinsh99 It appears that you marked that stackoverflow answer to your question as a solution. Does that solve your issue?
from react-native-mapbox-navigation.
We're also seeing nearly the same issue as nitinsh99. For us, it complains about the _swift_getFunctionReplacement50, but for x86_64. We have react-native : v0.63.4, cocoapods 1.10.1, and xcode : 12.0 (also tried 12.4).
Removing$(toolchain dir)/usr/lib/swift-5.0/$(platform_name)
from the library search path allows us to compile, but then it crashes on startup on the simulator. Without removing that library search path, we've tried every combination of setting Don't Dead-strip Inits and Terms
as well as dead code stripping. Any ideas?
from react-native-mapbox-navigation.
@devguy22 this is a really nasty issue but I am pretty positive its not related to this react-native library as eventually things worked out for me without any change in this library.. The only I other think I could think of which you can try is flush out the derived data folder after you made library search path changes ~/Library/Developer/Xcode/DerivedData/*
from react-native-mapbox-navigation.
Thanks, we still see that error after trying to delete that DerivedData. Our error in XCode is this:
dyld: Library not loaded: @rpath/MapboxMobileEvents.framework/MapboxMobileEvents Referenced from: /Users/pcandel1/Library/Developer/CoreSimulator/Devices/AA14D9F7-C774-459E-A943-E0AF12E82A5B/data/Containers/Bundle/Application/040D8696-9838-4140-B85E-63586A84B7A1/shift.app/Frameworks/Mapbox.framework/Mapbox Reason: image not found
Any ideas? We tried manually adding that .a library to our project (in addition to the libPods .a), but it didn't help.
from react-native-mapbox-navigation.
@devguy22 I am having the same issue and tried everything I could but nothing helps. Updated the xcode, downgrading the react-native, creating a fresh project but nothing seem to work
from react-native-mapbox-navigation.
@LowBudgetMan @devguy22 I was able to find a "solution". I found out how https://github.com/react-native-mapbox-gl/maps is getting around this issue and they are using this hack - https://github.com/react-native-mapbox-gl/maps/pull/714
I added that to the .podspec
for this library and it solves the main build issue - https://github.com/homeeondemand/react-native-mapbox-navigation/blob/master/react-native-mapbox-navigation.podspec#L22
I'll be updating the readme also to document setting the Don't Dead-strip Inits and Terms
to YES
and removing the "$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)"
from library search paths. I'll release 1.0.2
later tonight.
from react-native-mapbox-navigation.
Just an update on this specific issue and related ones (hopefully the last update needed) -
It has been resolved as of release 1.0.2 and I have documented how to solve potential build issues in the readme - https://github.com/homeeondemand/react-native-mapbox-navigation#ios-specific-instructions
from react-native-mapbox-navigation.
@devguy22 @rossmartin Hey, I've been trying to implement this package in RN, got it working following @devguy22 advice with the use_frameworks! dynamic loading. But once i try to bring in some other packages (RNReanimated, react-native-screens, react-navigation) I get some non specific errors:
Just wondering if anyone has experienced similar issues when trying to integrate this package into your app. THANK YOU!
from react-native-mapbox-navigation.
@adhendo try not using use_frameworks!
from react-native-mapbox-navigation.
@zoolle only problem is im on a macbook m1/silicon so the use_frameworks! tag solved the issues i was having with the arch incompatibilities
Edit: ok after searching around I think your solution is correct of specifying which pods should use dynamic frameworks instead of just using the use_frameworks!
tag. @zoolle are you using cocoapods-user-defined-build-types to specify which pods to build dynamically?
from react-native-mapbox-navigation.
FYI if you're using the react native map library, the workaround may cause a problem: https://github.com/react-native-mapbox-gl/maps/issues/1097#issuecomment-781647269.
from react-native-mapbox-navigation.
Related Issues (20)
- Followed the steps to installation and I get a maven + sdk error for android HOT 5
- iOS Build error: '@objc' method 'copy(with:)' does not satisfy requirement of '@objc' protocol 'NSCopying
- Android: Getting the Blank blue screen and when navigate to another screen throwing an error. HOT 32
- Compiler issue with Maps v10
- Is there any solution to hide the top bar of map box navigation ?
- Android: Getting the Blank blue screen and when navigate to another screen throwing an error, how can i fixt it HOT 3
- Not able to run the project HOT 3
- Could not resolve com.facebook.react:react-native:+. HOT 1
- Expo EAS HOT 12
- Avoid coordinates HOT 2
- Map is Not Showing in Android. HOT 24
- Is this library still maintained? HOT 4
- Android: Getting the Blank blue screen
- iOS: how to hide sound and report problem button
- Navigation moving on its own even after shouldSimulateRoute is set to false
- Trying to install, pods dependencies not working HOT 3
- Is it possible offline navigation if you download Mapbox offline HOT 1
- Android - When set shouldSimulateRoute to false app is crashed when open the mapbox navigation. HOT 8
- Route matching
- Multiple commands produce HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-native-mapbox-navigation.