GoogleMaps-SP
GoogleMaps-SP copied to clipboard
Add support for Apple Silicon (arm64) to iOS Simulator builds
I have the same issue. Has anyone found a workaround?
Is there a way to change the settings to build for arm_64 simulator?
Is there a way to change the settings to build for arm_64 simulator?
Not if you link any binary that does not have an ARM64 slice for the simulator.
Google provides two versions of the SDK now:
-
v7.1.0
in form of legacy fat frameworks (without support for ARM64-simulator) -
v7.1.0-beta
in form of XCFrameworks (with ARM64-simulator support)
There are two problems:
- This project is using
v7.1.0
(so, no ARM64-simulator support) -
v7.1.0-beta
does have ARM64-simulator support, but for some reason can't be used as a Swift Package dependency (it builds but app fails to start)
Here is my (experimental) solution: https://github.com/darrarski/GoogleMaps-SP
It can be used as a dependency of Swift Package and provides ARM64-simulator support (without running through Rosetta).
Enjoy, I hope it helps :-)
Google provides two versions of the SDK now:
v7.1.0
in form of legacy fat frameworks (without support for ARM64-simulator)v7.1.0-beta
in form of XCFrameworks (with ARM64-simulator support)There are two problems:
- This project is using
v7.1.0
(so, no ARM64-simulator support)v7.1.0-beta
does have ARM64-simulator support, but for some reason can't be used as a Swift Package dependency (it builds but app fails to start)Here is my (experimental) solution: https://github.com/darrarski/GoogleMaps-SP
It can be used as a dependency of Swift Package and provides ARM64-simulator support (without running through Rosetta).
Enjoy, I hope it helps :-)
The problems with Google's XCFrameworks are:
- They don't contain an Info.plist file.
- They binary inside is a static library rather than a dynamic library.
The problems with Google's XCFrameworks are:
They don't contain an Info.plist file.
They binary inside is a static library rather than a dynamic library.
That's true. I think there's no other way around than to use them if we need ARM64 simulator support at the moment.
My approach is to rebuild the XCFrameworks using (slightly modified) script from this repo and thin frameworks contained inside Google's official XCFrameworks. A bit hacky, but works for me (in simulator on M1 and on a physical device).
Hopefully Google will fix their frameworks, so we can use them directly.
The problems with Google's XCFrameworks are:
- They don't contain an Info.plist file.
- They binary inside is a static library rather than a dynamic library.
That's true. I think there's no other way around than to use them if we need ARM64 simulator support at the moment.
My approach is to rebuild the XCFrameworks using (slightly modified) script from this repo and thin frameworks contained inside Google's official XCFrameworks. A bit hacky, but works for me (in simulator on M1 and on a physical device).
Hopefully Google will fix their frameworks, so we can use them directly.
I tried embedding Google's XCFrameworks inside this repo XCFrameworks and it was a success, one problem was The framework name need to be different than Google's framework names to prevent linking collisions i.e renaming GoogleMaps.framework to GoogleMaps_.framework (either Google's one or this repo one).
I tried embedding Google's _XCFramework_s inside this repo _XCFrameworks and it was a success, one problem was The framework name need to be different than Google's framework names to prevent linking collisions i.e renaming GoogleMaps.framework to **GoogleMaps.framework** (either Google's one or this repo one).
Not sure I understand the name collision issue. You can store GoogleMaps.framework
for the device and GoogleMaps.framework
for the simulator in separate directories... or just use GoogleMaps.xcframework
from Google, which contains both (as I did).
@darrarski Thank you so much for sharing the code! I've been trying to reverse engineer the whole process (creation of Xcode projects, setting up dependencies). Could you please share how you setup linking between GoogleMaps & GoogleMapsBase & GoogleMapsCore? I'm now stuck at Undefined symbols for architecture arm64
😕
I didn't do anything special here. Started by forking this repository and duplicating the Xcode project to have two of them. One is using ".framework" files for physical devices and second for simulators. I've got these frameworks from official XCFramework file downloaded from Google (ver. 7.1.0-beta). That's it.
Thank you! I’ll try the same!
@karimhm perhaps you can shed some light on dependencies setup?
@karimhm perhaps you can shed some light on dependencies setup?
What are you trying to achieve?
I would like to know how GoogleMaps.xcodeproj
is created. This'll help me re-create it by myself so that I know how to update it in a future.
As far as I can see you:
- started with empty project
- created 5 library targets
- added
GoogleMaps
,GoogleMapsBase
etc. folders with "create groups" option enabled - made headers public and setup resource bundle copying
- did not yet known to me linking setup
@karimhm Zipped xcarchives produced by ./make_xcframework.sh -x
are unusually small. Binaries from Google's framework are stripped.
I figured out how to re-create GoogleMaps.xcodeproj
from ground up 🎉 Thank you, @karimhm, for working reference!
Any news on this? Building for arm64
still gives errors even with 7.2.0
version.
Is there an update on this? Xcode 14.3's release notes clearly state that it doesn't support Rosetta anymore. Updating this repo to support the latest version of Maps would be incredible 🙌
Is there an update on this? Xcode 14.3's release notes clearly state that it doesn't support Rosetta anymore. Updating this repo to support the latest version of Maps would be incredible 🙌
That's really a Google question. I don't get why it takes them so long to update one of their most used libraries...
fwiw, I found this one https://github.com/gomore/GoogleMaps-SPM which has 7.3.0
@bsrz did you manage to get that one working? It claims to be working with M1, but even on a fresh project I get errors.
@svachmic yes, it's working for us, we're all on M1 and our CI machines are on Intel, everything works.
Thanks @bsrz for a quick reply!
I don't know what I'm doing wrong - I add it to my project simply by adding another SwiftPM dependency using Xcode's UI, I select all the packages (GoogleMaps, GoogleMapsCore and the third one that escapes me now), the code compiles but when I want to run it in the simulator or on an iPhone, I get an error that an Info.plist is missing in the GoogleMaps package.
Am I missing a step? Am I supposed to run the shell script in the repo or add some build phase? I am seeing this same behavior both in my project which used to have Google Maps installed via cocoapods and in a fresh new Xcode project.
@svachmic We're not using Xcode's UI for this, I'm using it in a local package for modularization. We don't have any build phases for this either.
We're supporting iOS 14+ not sure if this has an impact for you?
@bsrz thanks for your env description. It was actually more trivial than that. The newest version (8.0.0) is simply buggy. When I used the version below (7.3.0) it works just fine.