可可豆荚和Google Maps SDK [英] Cocoa Pods and Google Maps SDK

查看:65
本文介绍了可可豆荚和Google Maps SDK的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用CocoaPods获取iOS版Google Maps SDK时,导入sdk头文件时遇到了麻烦( #import< GoogleMaps / GoogleMaps.h> ) .br

我是CocoaPods的新手,但我认为我使用的其他库(RestKit,AFNetworking ...)一切正常。
对于这些API,我仍然需要像这样导入库 #import< AFNetworking / AFNetworking.h> 而不只是 #import AFNetworking

对于Google Maps SDK,我需要像这样 #import< Google-Maps-iOS-SDK / GoogleMaps / GoogleMaps.h> 会导致编译错误,因为在GoogleMaps.h标头中,其他文件的导入方式如下:

When using CocoaPods to get the Google Maps SDK for iOS, I'm having troubles importing the sdk header file (#import <GoogleMaps/GoogleMaps.h>).
I'm new to CocoaPods but I think I have everything working fine with the other libraries that I use (RestKit, AFNetworking...). For these APIs I still need to import the lib like this #import <AFNetworking/AFNetworking.h> instead of just #import "AFNetworking". But it works fine.
For Google Maps SDK I need to import it like this #import <Google-Maps-iOS-SDK/GoogleMaps/GoogleMaps.h> which leads to a compilation error because in the GoogleMaps.h header the other files are imported like this:

#import <GoogleMaps/GMSCameraPosition.h>
#import <GoogleMaps/GMSCameraUpdate.h>
#import <GoogleMaps/GMSCircle.h>
...

我错过了什么吗?

推荐答案

您不必使用< >导入与CocoaPods链接的任何内容; 。它应该只是 #import Foo.h 。对于基于我的测试项目的Google Maps,我只需要使用 #import GoogleMaps.h 即可正确导入。确保您使用的是最新版本的CocoaPods( pod --version 当前为0.21.0)进行安装,否则可能需要更新它( [ sudo] gem update )。还要确保您打开的是创建的 xcworkspace 文件,而不是 xcodeproject

You should not have to import anything linked with CocoaPods using < and >. It should simply be #import "Foo.h". In the case of Google Maps based on my test project I just had to use #import "GoogleMaps.h" and it imported correctly. Make sure you're installing with the newest version of CocoaPods (pod --version currently 0.21.0) otherwise you may need to update it ([sudo] gem update). Also make sure you're opening the created xcworkspace file instead of the xcodeproject

这篇关于可可豆荚和Google Maps SDK的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆