Linker errors in a Swift project with Google Maps for iOS added via CocoaPods
I’m trying to add Google Maps SDK for iOS for a Swift project I’m working on via CocoaPods since CocoaPods now supports Swift.
Here’s my podfile.
source 'https://github.com/CocoaPods/Specs.git' use_frameworks! platform :ios, '7.0' pod 'Google-Maps-iOS-SDK'
Pod installation completes successfully and I could import the framework like this
import GoogleMaps without any compilation errors.
But then I went ahead and added a UIView and set its class to
GMSMapView and added a IBOutlet to my view controller and build the project. I get the following error.
Linker command failed with exit code 1 (use -v to see invocation)
I’ve added and used libraries written in Objective-C like MagicalRecord, MBProgressHUD on Swift projects without any issue.
I uploaded a demo Xcode project here as well.
Any way to resolve this?
2 Solutions Collect From Internet About “Linker errors in a Swift project with Google Maps for iOS added via CocoaPods”
The problem that you are facing is a combination of a bug on CocoaPods and a malformed podspec. Check this for more information.
Feel free to use this podspec:
… in your Podfile as:
pod 'Google-Maps-iOS-SDK', :podspec => "https://raw.githubusercontent.com/Reflejo/GoogleMapsPodspec/master/Google-Maps-iOS-SDK.podspec.json"
Response from a Google engineer:
I believe this bug is now fixed in 1.10.0. As part of moving to officially supporting CocoaPods we have changed the name of the Google Maps SDK for iOS CocoaPod. Please update your Podfile like this:
source 'https://github.com/CocoaPods/Specs.git' platform :ios, '8.3' use_frameworks! pod 'GoogleMaps', '1.10.0'
(source of this information)
Nonetheless the fix above introduces a new warning, please see the following link.
So I personally recommend you staying with
pod 'Google-Maps-iOS-SDK', :podspec => "https://raw.githubusercontent.com/Reflejo/GoogleMapsPodspec/master/Google-Maps-iOS-SDK.podspec.json" until the bug will be fixed in a newer version of the Google Maps iOS SDK, or simply silencing this warning by adding
-Wl,-no_compact_unwind in build settings flags.
- LLVM 2.0 can't build for iPhone simulator. GCC 4.2 works fine
- How to authenticate a user in Parse iOS SDK using OAuth?
- Find Frame Coordinates After UIView Transform is Applied (CGAffineTransform)
- iOS/Swift: How to implement longPressed action for backButton?
- Quickly view the type of a Swift variable in XCode
- How to get own mobile number from the iOS Device programatically?
- Send POST request using NSURLSession
- In app purchase – Storing/fetching user purchase history | iOS
- Updating apps to iOS6
- GMSMarker icon from center (iOS)
- AVCaptureStillImageOutput area selection
- Rotate two SKSpriteNodes with SKPhysicsJointFixed in Swift
- Can you use XCode6.3 with IOS7.1 SDK
- How to read cell data from an Excel document with objective-c
- UITableView not scrollable but enough height