ios - 如何使用 use_frameworks cocoa pods 和 Google SDK

标签 ios swift google-maps cocoapods google-maps-sdk-ios

我正在构建一个简单的 iOS (Swift) 应用程序 - 它渲染 map 并在其上绘制标记。

当我的 Podfile 运行时,它工作正常

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.1'

pod 'GoogleMaps'

但是当我将其更改为这个(注意 use_frameworks!)

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.1'
use_frameworks!

pod 'GoogleMaps'
pod 'Alamofire', '~> 1.3'

我收到以下错误。

错误:

CoreData: warning: Unable to load class named 'GMSCachedObject' for entity 'GMSCachedObject'.  Class not found, using default NSManagedObject instead.
2015-08-11 12:30:44.419 Closest[1784:15704] CoreData: warning: Unable to load class named 'GMSCachedTile' for entity 'GMSCachedTile'.  Class not found, using default NSManagedObject instead.
2015-08-11 12:30:44.421 Closest[1784:15704] -[NSManagedObject tileCoords]: unrecognized selector sent to instance 0x7ff6d0cbf750
2015-08-11 12:30:44.450 Closest[1784:15704] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSManagedObject tileCoords]: unrecognized selector sent to instance 0x7ff6d0cbf750'

我应该做些什么不同的事情?

最佳答案

After some debugging I realised that the issue arose when attempting to use both ObjectiveC pods (such as GoogleMapsSDK) and Swift libraries such as Alamofire.

A really simple solution is to add -ObjC to your linkers in XCode which will tell it to compile the ObjectiveC pods.

After adding the linker everything compiles and I’m able to use the two pods in unison.

来源:http://luke-berry.co.uk/2015/08/19/google-maps-and-alamofire/

关于ios - 如何使用 use_frameworks cocoa pods 和 Google SDK,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31935371/

相关文章:

swift - Q : How to Update Boolean Value?

ios - Swift - 如何将复杂对象写入 Firebase 实时数据库

ruby-on-rails - 有什么方法可以让 gmaps4rails 在街景 View 中打开 map ?

google-maps - Google Maps API - 未定义的 ROADMAP 属性?

google-maps - 由于外部链接导致的谷歌抓取错误

ios - Swift Enum design issues : 1. multiple cases having same value, 2.返回自定义枚举值

ios - 有一个更好的方法吗?想使用循环,但它中断了

ios - 在数据库中存储数组属性

ios - Xcode Storyboard : Why does the iPad storyboard show iPhone sized views?

ios - 快速对象映射