简体   繁体   English

链接Google API iOS静态库

[英]Linking the Google API iOS Static Library

I am trying to link the Google API into my iOS Application. 我正在尝试将Google API链接到我的iOS应用程序中。 I have downloaded the google-api-objectivec-client from their website and I am following the first option instructions to link the static library ("Linking to the iOS Static Library"). 我已经从他们的网站上下载了google-api-objectivec-client ,并且正在按照第一个选项的说明来链接静态库(“链接到iOS静态库”)。

Here was my process: 这是我的过程:

  • Drag GTL.xcodeproj into my workspace. 将GTL.xcodeproj拖到我的工作区中。
  • In my main project Build Phases tab, I've added GTLTouchStaticLib under Target Dependancies 在我的主项目“ 构建阶段”选项卡中,我在“ 目标相关性”下添加了GTLTouchStaticLib。
  • Then I've gone over to the Compile Sources tab, and I've added libGTLTouchStaticLib.a 然后,转到“ 编译源”选项卡,并添加了libGTLTouchStaticLib.a
  • Under Build Settings , I've added '-ObjC-all_load' in the Other Linker Flags field. 在“ 构建设置”下 ,我在“其他链接器标志”字段中添加了“ -ObjC-all_load”。

Now, before Google tell you to make the Other Linker Flags changes, they tell you to: 现在,在Google告诉您进行“其他链接器标记”更改之前,他们告诉您:

The static library target also creates a folder with the library's headers to drag into your target's sources. 
The headers folder is created in the build products directory. To find build products directory, in Xcode 4's Locations preferences pane, click the arrow for Derived Data.

So I go ahead and do this, and the Header files are now in my target sources. 因此,我继续执行此操作,并且Header文件现在位于我的目标源中。 So I figured that before I go ahead and add any of the services they offer, I should compile it and just make sure everything is OK. 因此,我认为在继续添加他们提供的任何服务之前,我应该对其进行编译,并确保一切正常。 My project wouldn't compile, giving 19 compiler errors, to the tune of: 我的项目无法编译,给出19个编译器错误,其中包括:

Undefined symbols for architecture armv7:
  "_kSecValueData", referenced from:`-[GTMOAuth2Keychain setPassword:forService:accessibility:account:error:] in` libGTLTouchStaticLib.a(GTMOAuth2ViewControllerTouch.o)

So obviously something is going wrong here. 所以很明显这里出了问题。 Does anybody have any ideas? 有人有什么想法吗? I've read some documentation and many other stack questions, and it seems that everybody has different ideas and slightly different problems and I just cant figure it out. 我已经阅读了一些文档和许多其他堆栈问题,似乎每个人都有不同的想法和稍有不同的问题,我只是想不通。 Cheers! 干杯!

Embarrassing that I didnt actually google part of the error code. 令人尴尬的是,我实际上并未在Google上看到部分错误代码。 Anyway seems I didnt include Security.framework and SystemConfiguration.framework. 无论如何,我似乎没有包含Security.framework和SystemConfiguration.framework。 Ill probably need the other two they suggest sometime later too. 以后可能还会请病假他们提出的另外两个建议。 Source: https://groups.google.com/forum/#!msg/gtm-oauth2/TVgSxG3129A/xcfsF9gmkgIJ 来源: https//groups.google.com/forum/#! msg / gtm- oauth2 / TVgSxG3129A / xcfsF9gmkgIJ

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM