Skip to content
Blog iPhone(iOS) programming: Get Google Contacts

iPhone(iOS) programming: Get Google Contacts

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.

Next: Add the Gdata headers and other required frameworks and libraries
Pages: 1 2 3 4

21 thoughts on “iPhone(iOS) programming: Get Google Contacts”

  1. Hitesh H Rajyaguru

    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)

  2. 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.

  3. 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.

  4. 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

  5. // Notes
    GDataEntryContent *content = [contact content];
    NSString *notes = @"";
    if (content && [content contentStringValue]) {
        notes = [content contentStringValue];
        NSLog(@"notes   :  %@", notes);
    }
  6. 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.

  7. Hi,

    You can get the address using the following code:

    GDataStructuredPostalAddress *address = [[contact structuredPostalAddresses] objectAtIndex:0];
    if (address) {
        NSLog(@"formattedAddress   :  %@", [address formattedAddress]);
    }

    You can also use the following if you need the individual elements instead of the ‘formattedAddress’:

    city, countryName, countryCode, houseName, neighborhood, POBox, postCode, region, street, subregion
  8. 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! 🙂

  9. 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! 🙂

  10. 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.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.