Latest 1.0.1
License MIT
Platforms ios 6.0, requires ARC

Guessing a user’s favorite contacts on iOS

Demo application screenshot

This repository contains code for an App Store-legal heuristic that guesses the favorite contacts in a user’s address book on iOS. Many iOS apps provide an "invite your friends" feature. From a usability design perspective it is desireable that the app suggests friends that are likely to be invited by the user.

The code is described in closer detail in this blog post.

Example Usage

The implementation of the heuristic is contained in DBFriendInviter.h and DBFriendInviter.m.

This will give you the 10 most important contacts in the address book:

#import "DBFriendInviter.h"
NSArray *contacts = [DBFriendInviter mostImportantContacts];

The returned list consists of an NSArray of ABRecordIDs. Each ABRecordID is wrapped in an NSNumber instance. The list is sorted by descending importance, i.e. the most important contacts are first.

You can also change the number of returned results or exclude a set of blacklisted contacts using the following function:

NSMutableSet *blacklistedContacts = [NSMutableSet set];
[set addObject:@(recordID_1)];
// ...
[set addObject:@(recordID_N)];

NSArray *contacts = [DBFriendInviter mostImportantContactsWithIgnoredRecordIDs:blacklistedContacts

Demo application

The repository contains a demo application for iOS 6.


Daniel Bader – Twitter: @dbader_org

The code made available here is described in closer detail in this blog post.


All code in this repository is available under the MIT license. See the LICENSE file for more info.

Latest podspec

    "name": "MostImportantContacts",
    "version": "1.0.1",
    "summary": "Most Important Contacts",
    "description": "iOS Helper Methods for finding a user's most important contacts",
    "homepage": "",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    "authors": {
        "dbader, medhelp": "[email protected]"
    "source": {
        "git": "",
        "tag": "1.0.1"
    "platforms": {
        "ios": "6.0"
    "requires_arc": true,
    "source_files": "MostImportantContacts/DBFriendInviter.{h,m}"

Pin It on Pinterest

Share This