This tutorial walks you through on how to retrieve google contacts programatically using Objective C.
Here,
1. I am going to create a Single View project for the tutorial.
2. Add the GData headers and other required frameworks and libraries.
3. A screen to get the Username and Password.
4. Retrieve Contacts.
1. Create a new Single View project (For beginners).
This is a tutorial, so i am creating a new project to demonstrate what we are trying to achieve.
The library is old. Let me see if i can find the latest one.
Undefined symbols for architecture x86_64:
“_OBJC_CLASS_$_GDataQueryContact”, referenced from:
objc-class-ref in MainScreenViewController.o
“_OBJC_CLASS_$_GDataServiceGoogleContact”, referenced from:
objc-class-ref in MainScreenViewController.o
“_kGDataServiceDefaultUser”, referenced from:
-[MainScreenViewController getGoogleContacts] in MainScreenViewController.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Check the logs. See if its indeed an authentication failure or some other error.
I encountered a problem like it was working perfectly for some mail id’s but for some mail id’s its showing “Authentication Failed”. Please help me out.
Hey,
Can you make sure the Headers and the library files have been added correctly?
I did all of the steps, but I’ve encountered some errors:
1. In ViewController.h at #import “GDataFeedContact.h” and “GDataContacts.h” it says the file can’t be found.
2. In ViewController.m, at [self getGoogleContacts], [self contactService], and [self setContactFetchTicket:ticket] it says that the “Receiver type ViewController for instance message does not declare a method with selector ..”
I’m using xcode 5.1.
Hey,
Plz check this out:
http://stackoverflow.com/questions/11968934/google-plus-sdk-emits-linker-errors-when-trying-to-integrate-with-iphone-app
Hey, i will updated it as soon as possible. And i wil update you. Thanks.
Hi there.. its good to see this static library. But having some issue.
Getting Below error….
Undefined symbols for architecture armv7:
“_OBJC_CLASS_$_GTMOAuth2ViewControllerTouch”, referenced from:
objc-class-ref in EmailHelperManager.o
objc-class-ref in LoginViewController.o
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
have you updated the static library for armv7 and armv7s? or it is something else error…?
Thanks
Thank you so much for all the help! One last question, is it possible to get the notes I add in my contacts? I can’t find it/get it in the gdata sources.
Birthday:
Hi,
You can get the address using the following code:
You can also use the following if you need the individual elements instead of the ‘formattedAddress’:
Hi! Sorry for sorta flooding your responses. I was wondering if you knew how to get other contact details such as primary address, birthdays, etc?
Thanks! 🙂
I got it to work already! THANK YOU SO MUCH FOR THIS TUTORIAL! 😀
I did all of the steps, but I’ve encountered some errors:
1. In ViewController.h at #import “GDataFeedContact.h” and “GDataContacts.h” it says the file can’t be found.
2. In ViewController.m, at [self getGoogleContacts], [self contactService], and [self setContactFetchTicket:ticket] it says that the “Receiver type ViewController for instance message does not declare a method with selector ..”
I’m using xcode 4.2 cause my mac is only on snow leopard.
I’m new to xcode, so this tutorial is really appreciated! Thank you for all the help! 🙂
Hi,
Have a look at this https://developers.google.com/google-apps/contacts/v3/?csw=1#authorizing_requests_with_oauth_20
I have used the Login with Gmail in my ios app. when user click with gmail login default gmail login window will be open in webview. where user can write therir username and password. and then after login succeessfully access to main view controller.
but in you app need to pass the user name and password to get the gmail contact. so how can i do this with my app.
The source you download have all google service.
I have complied and created the library for Google contacts. Thats the one i have given in the post.
Ah!
Sorry, i forgot to mention it.
https://code.google.com/p/gdata-objectivec-client/
This is great, thanks! I was just wondering where you got the GData library (or how you created it)?