-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Crash when switching away from app on iOS #3957
Comments
I'm not a maintainer/contributor of this package (yet... ;)), but my company do however use it in production, so I was compelled to look into this. First of all, could you please confirm that you are only experiencing this when running through Xcode? Are you able to relaunch/refocus your app after opening the multitasking window running through I suspect that this is the reason why this issue isn't reported more widely. If you are able to confirm the above, please try to edit your scheme to disable Metal Api Validation. Click your scheme name (likely your project name) to the left of your target device, press Re-run your app through Xcode. This should "fix" the crash. Do you observe this as well? If so, your crash is caused by Xcode running a Metal debugger when running through Xcode. I don't think this is caused by react-native-maps as the crash can be reproduced by running a barebone Xcode iOS project with nothing but a MKMapView in the main storyboard. As this doens't affect production builds, I don't have the time to look into why this is happening, but Google seems to suggest that this is a widespread error. The crash shouldn't affect your production builds what so ever. Feel free to get back to me if the above doesn't match your experience. |
@Simon-TechForm : Thanks for your really helpful and detailed answer. You're absolutely right — running outside the debugger, or turning off Metal API Validation, both make the issue go away. I've just verified both things as suggested. Closing the issue! |
Created #3961 to add this to the Troubleshooting section of the readme. |
* Update readme to address #3957 * Update readme link correctly * Fix spacing to be minimal delta from existing README Co-authored-by: Philip Su <philip@auderenow.org>
…ing tip (react-native-maps#3961) * Update readme to address react-native-maps#3957 * Update readme link correctly * Fix spacing to be minimal delta from existing README Co-authored-by: Philip Su <philip@auderenow.org>
Hello , i got the same issue, however on unchecking api validation the error doesn't go while running in debug mode. For production mode , i archieved it with release mode still it is crashing. Please let me know other steps. |
|
Bug report
Summary
<MapView>
crashes on iOS if you switch away from the app to another app, with EXC_BAD_ACCESS (code=EXC_I386_GPFLT). This happens only if you usemaptype="standard"
with the default provider (Apple Maps), and is consistently reproducible if you useflex:1
(though it also reproduces intermittently if you specify exact dimensions [width/height]).Environment info
Using standard out-of-the-box Apple Maps.
react-native info
output:Steps to reproduce
npx react-native init MyApp --template react-native-template-typescript
yarn add react-native-maps
yarn && cd ios && pod install
flex:1
.MyApp/ios/MyApp.xcworkspace
in XCode.Describe what you expected to happen:
Describe what you actually happens:
Reproducible sample code
https://gist.github.com/fivecar/5aaca5b99d37a011a5793be21b502c7d. The cleanest way to set this up is to follow the repro instructions above.
NOTE: It took me some time to figure this out, but there are three important caveats:
flex:1
but inconsistently with specifying a defined width/height (e.g.width: 400, height: 400
). So if you insist on setting a width/height, you'll need to fiddle a few times, recompiling things, re-running it, to get the repro. I find that running once withflex:1
and then setting explicit width/height is pretty consistent. But 100% reliable is simply sticking withflex:1
. (App crashing when being put into background with MapView component mounted #3650 claims that width/height fixes it, but I've done some pretty thorough testing that suggests it's simply less reliable to repro with width/height).mapType
to anything butstandard
. If you set it tosatellite
orhybrid
, etc, it won't reproduce. So either set it tostandard
, or don't setmapType
at all.provider={PROVIDER_GOOGLE}
It took a long time, some
git bisect
, and a bunch of style fiddling to figure out the minimum repro on this. But I'm surprised others haven't reported this, given how reliable it reproduces (and how consequential the aftermath). I'm happy to help fix this if someone points me the right direction, but I've never looked into the codebase and would largely be stabbing in the dark.The text was updated successfully, but these errors were encountered: