Xcode 7 上 Gmail API 的快速启动说明不起作用

Quick start instructions for Gmail API on Xcode 7 do not work(Xcode 7 上 Gmail API 的快速启动说明不起作用)

本文介绍了Xcode 7 上 Gmail API 的快速启动说明不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

跟进

然后,您将遇到我上面提到的链接器问题.在网上摸索并查看丢失的内容后,问题是构建需要几个额外的文件:

除了快速入门中指示的内容外,我还用红色破折号标记了必须添加的内容.另请注意,其中一些必须在没有 ARC 的情况下编译,这显示在红色圆圈中.

接下来,将其包含在 我的 项目中.

Following up on Gmail API iOS in Xcode 7, Swift 2, I followed the directions, but then ran into the problems listed here: https://groups.google.com/forum/#!topic/google-api-objectivec-client/Eq2yW8KdjRU. They point out a few things that are wrong with the Quickstart instuctions and I (as they did) worked thru them as best we could. In the end, the remaining problem is linking, which looks like:

Undefined symbols for architecture i386:
"_OBJC_CLASS_$_GTLObject", referenced from:
  _OBJC_CLASS_$_GTLGmailDraft in GTLGmail_Sources.o
  _OBJC_CLASS_$_GTLGmailHistoryLabelAdded in GTLGmail_Sources.o
  _OBJC_CLASS_$_GTLGmailHistoryLabelRemoved in GTLGmail_Sources.o
  _OBJC_CLASS_$_GTLGmailMessage in GTLGmail_Sources.o
  _OBJC_CLASS_$_GTLGmailHistoryMessageAdded in GTLGmail_Sources.o
  _OBJC_CLASS_$_GTLGmailHistoryMessageDeleted in GTLGmail_Sources.o
  _OBJC_CLASS_$_GTLGmailHistory in GTLGmail_Sources.o
  ...
"_OBJC_CLASS_$_GTLQuery", referenced from:
  _OBJC_CLASS_$_GTLQueryGmail in GTLGmail_Sources.o
 (maybe you meant: _OBJC_CLASS_$_GTLQueryGmail)
"_OBJC_CLASS_$_GTLService", referenced from:
  _OBJC_CLASS_$_GTLServiceGmail in GTLGmail_Sources.o
 (maybe you meant: _OBJC_CLASS_$_GTLServiceGmail)
"_OBJC_CLASS_$_GTMOAuth2ViewControllerTouch", referenced from:
  type metadata accessor for __ObjC.GTMOAuth2ViewControllerTouch in ViewController.o
"_OBJC_METACLASS_$_GTLObject", referenced from:
  _OBJC_METACLASS_$_GTLGmailDraft in GTLGmail_Sources.o
  _OBJC_METACLASS_$_GTLGmailHistory in GTLGmail_Sources.o
  _OBJC_METACLASS_$_GTLGmailHistoryLabelAdded in GTLGmail_Sources.o
  _OBJC_METACLASS_$_GTLGmailHistoryLabelRemoved in GTLGmail_Sources.o
  _OBJC_METACLASS_$_GTLGmailHistoryMessageAdded in GTLGmail_Sources.o
  _OBJC_METACLASS_$_GTLGmailHistoryMessageDeleted in GTLGmail_Sources.o
  _OBJC_METACLASS_$_GTLGmailLabel in GTLGmail_Sources.o
  ...

In the SO thread above I first referenced, it is suggested that a new Gmail SDK corrects these problem. I re-pulled everything two days ago but still have the linking errors.

So I am not sure how to install the new version of the SDK as mentioned ... can someone point me as to which SDK I am updating and how to do it? Thanks!

解决方案

OK I figured it out. First you need to overcome the 'glitches' as described https://groups.google.com/forum/#!topic/google-api-objectivec-client/Eq2yW8KdjRU . This includes noting that the projects now have the word 'Core' added to them, fixing the swift file for 2.0 operation, ignoring Steps 3e and f. Also, make sure that each project has iOS selected as architecture. As I thought the i386 build is for the simulator, to explicitly show why that is getting build you can see this here (iOS is implying both iphoneos and iphonesimulator even though i386 does not show in the Valid Architectures list):

You will then be at the spot that I was above, with linker problems. After fumbling around the net and seeing what was missing, the problem is that several additional files are required for the build:

I marked the ones that must be added in addition to the ones indicated in the quickstart with red dashes. Also note that some of these must be compiled without ARC, this is shown in the red circle.

Next, including this in my project.

这篇关于Xcode 7 上 Gmail API 的快速启动说明不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本文标题为:Xcode 7 上 Gmail API 的快速启动说明不起作用

基础教程推荐