How to Use Gdata in iOS

How to use GData in iOS?

Step 1

The first step, is to head on over to the Google Code website for the Objective-C Client, download and extract the zip file source code. Alternatively, you can get the latest and greatest version via Git using:

git clone https://github.com/google/gdata-objectivec-client

If you downloaded the zip file from the website, you’ll have version 1.7.0.

Step 2

Open up the GData Xcode Project from your downloaded folder as well as your iPhone App Xcode project.

Step 3

Drag over the GData Sources Folder from the GData project to your iPhone App project and add it as reference [don't check the box for Copy items into destination group's folder (if needed).] You do not need to copy over all the files into your project. You can, but it’s not required.

Step 4

Open up the build settings for your iPhone App project. Located and set the following settings.
* Header Search Paths: /usr/include/libxml2 ../gdata-objectivec-client-1.9.1/Source
* Other Linker Flags: -lxml2, -ObjC

For the Debug build configuration only, add the Other C Flags setting so that the library’s debug-only code is included:

Other C Flags: -DDEBUG=1

Step 5

Now be sure that the downloaded source code is in the same directory in which your actual Code Folder is.

Step 6
Make sure I've the frameworks "SystemConfiguration.FrameWork" and "Security.FrameWork" added to your project.

Hope it helps..These are the steps for GData integration

How to include GData in project?

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.

How to run project with Gdata library

gdata is a monolithic library, and the objective-c version lets you use the preprocessor mechanism to link out the services you aren't interested in. Seems like it should be a convenience feature, but the author chose to make it mandatory. It's probably for the best: using it liposucked 4MB out of my binary.

e.g. say you want to use just the YouTube API on iOS, you'd open the GData project, duplicate libGDataTouchStaticLib.a target, then add

-DGDATA_REQUIRE_SERVICE_INCLUDES=1
-DGDATA_INCLUDE_YOUTUBE_SERVICE=1

to Build Settings > Other C Flags

This fixes your build problem and gives you a leaner app. Bonus!

Any tutorials for using GData API to upload to video to youtube form iOS app?

You can find a well written example from creators' page of GData for Objective C.
You just need to download the latest source from his project svn (Just type this code on your terminal application)

svn checkout http://gdata-objectivec-client.googlecode.com/svn/trunk/ ~/Desktop/gdata-objectivec

and search inside ~/Desktop/gdata-objectivex/Examples/YoutubeSample.
In this directory there is a project implementing login with Oauth2, upload of a video and more operations.

This is the basic, I also suggest you to read the general API from youtube here http://code.google.com/apis/youtube/overview.html.

ios iPhone / iPad - Project with GData static library libGDataTouchStaticLib.a fails on build (duplicate symbol)

You shouldn't have to copy in GDataXMLNode.h and GDataXMLNode.m to your project. I believe the reason you are getting the duplicate symbol error is because the libGDataTouchStaticLib.a library already contains the compiled GDataXMLNode.m class.

I am currently using the GData library in a project I am working on, and got it set up by using these instructions: http://hoishing.wordpress.com/2011/08/23/gdata-objective-c-client-setup-in-xcode-4/, so this answer assumes that you have the same setup. However I have used a slightly different way of importing the headers that was suggested by one of the comments on the above blog.

In your Xcode project remove the GDataXMLNode.h and GDataXMLNode.m files, and make sure that the GData.xcodeproj project is linked into your project the same way as in the above blog, but do not drag the headers directory to your source tree. Add these arguments to the Debug and Release Header Search Paths of your current target instead:

/usr/include/libxml2
${BUILT_PRODUCTS_DIR}/Headers

You can find this under the Build Settings tab of your target. The second argument will import all the GData headers into your project if you have set up the GData.xcodeproj file correctly. Once you have done this you should be able to import the various GData classes including GDataXMLNode.h class wherever you need it by typing this at the top of the appropriate class:

#import "GDataXMLNode.h"

Much credit goes to Kelvin's blog for his great tutorial. Hope that helps!

How to execute Gdata client application in iphone os 4.2

Use of the library is the same for iOS and for Mac. Just add the library to your project as described on the wiki and follow the directions on using the library.

Use GData to Parse XML with Text containing HTML

You need to call XMLString method of GDataXMLNode. It will return you XML/HTML representation in string format.

NSString * para = [[[content elementsForName:@"Paragraph"] objectAtIndex:0] XMLString];


Related Topics



Leave a reply



Submit