Giter Site home page Giter Site logo

abgetme's Introduction

About

Unlike the Mac Address Book API, the iOS Address Book API does not come with the ABGetMe function. ABGetMe circumvents this limitation by trying to read My Info from the Contacts settings.

Contacts Settings

If My Info is not found, then ABGetMe tries to match the configured e-mail account addresses with the records of the address book to find the me record.

If the me record is still not found, then ABGetMe finally tries to extract the device owner's full name from the device name in order to find the me record. This technique was explained by John Feminella in his answer to How does Square know my name in their app's registration process? on Quora.

Requirements

  • ABGetMe requires iOS 4.0 or later.
  • ABGetMe can be compiled either with or without Automatic Reference Counting (ARC).

Usage

  1. Copy ABGetMe.h and ABGetMe.m into your Xcode project

  2. Use the ABGetMe() function and don’t forget to check if the result is not NULL.

     ABAddressBookRef addressBook = ABAddressBookCreate();
     ABRecordRef me = ABGetMe(addressBook);
     if (me) {
     	// do something with "me"
     }	
     CFRelease(addressBook);
    

Limitations

ABGetMe is not legally App Store compliant because it uses undocumented APIs which is proscribed by clause 3.3.1 of the iPhone Developer Program License Agreement. It is technically App Store compliant though as it will pass the App Store validation. Moreover, it should not crash even if the undocumented APIs change in the future.

  • Reading My Info from the Contacts settings uses undocumented APIs.
  • Reading configured e-mail account addresses uses undocumented APIs.
  • Reading the device name is a public API.

You can disable private APIs by setting ABGETME_ENABLE_PRIVATE_APIS to 0 instead of 1 at the top of the ABGetMe.m file. Note that disabling private APIs considerably reduces the chances of finding the me record. The only method left to find the me record when disabling private APIs is the last one (i.e. matching the device name) which only works if the device owner never changed the default device name.

abgetme's People

Contributors

0xced avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.