1

I'm trying to include GData framework in my project for hours now and I'm completely lost. I'm trying to follow instructions on gdata-objectivec-client's page (https://code.google.com/p/gdata-objectivec-client/), but they're very outdated.

If I try to link static library (using instructions from this site, which is referenced in installation guide -> https://hoishing.wordpress.com/2011/08/23/gdata-objective-c-client-setup-in-xcode-4/) In the end I get those errors:

Undefined symbols for architecture arm64:
  "_OBJC_CLASS_$_GDataServiceGoogleSpreadsheet", referenced from:
  objc-class-ref in ViewController.o
  "_kGDataGoogleSpreadsheetsPrivateFullFeed", referenced from:
  -[ViewController fetchFeedOfSpreadsheets] in ViewController.o
ld: symbol(s) not found for architecture arm64

What I found out is that they might be caused by gdata-objectivec-client being not ARC compatible. It could be fixed by adding "-fno-objc-arc" flags in Build Phases -> Compile Sources if there have been gdata's files, but since I'm cross-referencing project there are not there.

Other method is compiling source files directly, but the method provided is very outdated. First step is to drag "Source" group from GData project to my project and that is not possible in Xcode for a long time now. For what I know, today I have to open project files in Finder and drag them to my project, but that way I'm importing whole project, not only source files. Also if I do it that way folder in Project Explorer is blue and I can't import any of GData's header files.

I'm out of ideas what should I do next to make this work with Xcode 6 and iOS8, any help will be very appreciated.

raven_raven
  • 343
  • 2
  • 6
  • 17

2 Answers2

2

OK, it turns out that as of today, that is not a simple matter. I had absolute no luck with tutorials provided in Google's documentation (be it a static library or compiling from source). I also tried cocoa pods by making a Podfile and requesting a pod 'GData', which also is broken. One of the dependencies is doubled and makes a lot of "duplicate symbol" errors. But it turns out that it can be quite easily fixed and I finally was able to use GData Objective-C client with iOS8 and Xcode 6.3.

Here's what you have to do (I assume that you already have working cocoa pods installation on your machine):

pod init

In console, navigate to root of your project and type 'pod init'

Insert this in a podfile:

pod 'GData', :podspec => 'GData.podspec.json'

Create custom podspec file with removed duplicate dependency from official podspec.

We have to delete troublesome "GTMHTTPFetcher" from dependencies. Create a file named GData.podspec.json in root catalog of your project. Fill it with content so it looks like that:

{
  "name": "GData",
  "version": "1.12.0",
  "license": {
    "type": "Apache License, Version 2.0",
    "file": "COPYING.txt"
  },
  "summary": "The Google data APIs provide a simple protocol for reading and writing data on the web. Many Google services provide a Google data API.",
  "homepage": "https://code.google.com/p/gdata-objectivec-client",
  "authors": {
    "The Google Data APIs team": "https://code.google.com/p/gdata-objectivec-client"
  },
  "source": {
    "svn": "http://gdata-objectivec-client.googlecode.com/svn/trunk"
  },
  "dependencies": {
    "gtm-oauth2": [

    ]
  },
  "requires_arc": false,
  "subspecs": [
    {
      "name": "Core",
      "source_files": [
        "Source/ACL/*.{h,m}",
        "Source/BaseClasses/*.{h,m}",
        "Source/Elements/*.{h,m}",
        "Source/Geo/*.{h,m}",
        "Source/Introspection/*.{h,m}",
        "Source/Media/*.{h,m}",
        "Source/Networking/*.{h,m}",
        "Source/XMLSupport/*.{h,m}",
        "Source/*.{h,m}",
        "Source/Clients/**/*.{h,m}"
      ],
      "libraries": "xml2",
      "xcconfig": {
        "HEADER_SEARCH_PATHS": "\"$(SDKROOT)/usr/include/libxml2\""
      }
    },
    {
      "name": "XMLNode",
      "source_files": "Source/XMLSupport/*.{h,m}",
      "libraries": "xml2",
      "xcconfig": {
        "HEADER_SEARCH_PATHS": "\"$(SDKROOT)/usr/include/libxml2\""
      }
    }
  ]
}

Update "version" in GData.podspec.json

Visit https://cocoapods.org/pods/GData and look up the latest version of GData at the top of the page. Replace "version" in the GData.podspec.json with that version number.

Execute 'pod install'

And you're done! Now the GData libraries will finally compile and you can start using this. This fix may not be big, but it really took me hours to find out what the problem was and how to eliminate it. I hope that it will prove useful to someone else.

yuklai
  • 1,595
  • 1
  • 14
  • 26
raven_raven
  • 343
  • 2
  • 6
  • 17
  • pod 'GData', :podspec => 'GData.podspec.json' when I paste this , it gives me error in terminal – va05 May 23 '16 at 06:53
  • @va05 Are you using cocoapods 1.0? If yes, you need to have pod under a target. So you will need to add `target '' do` and `end` and between them pase `pod 'GData', :podspec => 'GData.podspec.json'` – raven_raven May 23 '16 at 07:20
  • 1.0.0.beta.6 thats the version I am using. – va05 May 23 '16 at 07:34
  • # platform :ios, '8.0' # Uncomment this line if you're using Swift # use_frameworks! target 'Bowden' do pod 'JTMaterialSwitch' pod 'SDWebImage' pod 'AFNetworking', '2.6.1' pod 'SVPullToRefresh’ pod 'FBSDKShareKit' pod 'FBSDKLoginKit' pod 'JTMaterialSpinner' pod 'SZTextView' pod 'UIActivityIndicator-for-SDWebImage' pod 'RMPickerViewController' pod 'RMDateSelectionViewController','~> 2.0.0' pod 'IQKeyboardManager' pod 'SCLAlertView-Objective-C' pod 'RMMapper' pod 'STTwitter' pod 'GData', :podspec => 'GData.podspec.json' end – va05 May 23 '16 at 07:35
  • @va05 Are you creating custom podspec.json file in the root of your project? Because lack of this file is what is causing error you've pasted. – raven_raven May 23 '16 at 08:07
  • hey have you checked it? Actually I am in much trouble because of this – va05 May 23 '16 at 09:06
  • @va05 I'm not sure, but I think that Google Code, or at least this repo, is dead. Try replacing path at podspec with some mirror, like `"source": { "git": "https://github.com/google/gdata-objectivec-client" }` – raven_raven May 23 '16 at 09:11
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/112659/discussion-between-va05-and-raven-raven). – va05 May 23 '16 at 09:15
1

You will have to install the GDATA pods using - pod 'GData', '1.12.0'

Steps

  1. Open terminal and go to directory of your project
  2. if you already have pod file then edit and add pod 'GData', '1.12.0' else make new pod file and add same.(https://guides.cocoapods.org/using/using-cocoapods.html)
  3. now exit from pod file and give command install pod.

You will see the GData is installed in your app.

Note : After the installation you will have to delete troublesome "GTMHTTPFetcher" from dependencies.

Sumeet Bajaj
  • 224
  • 2
  • 11