CocoaPods trunk is moving to be read-only. Read more on the blog, there are 17 months to go.

SARAddressBookBackup 1.0.0

SARAddressBookBackup 1.0.0

TestsTested
LangLanguage Obj-CObjective C
License Custom
ReleasedLast Release Dec 2014

Maintained by Saravanan.



  • By
  • Saravanan
An iOS library to take Backup of the device contacts as .vcf file.

Instructions :

(i) Copy/Include the "SARAddressBookBackup.h" & "SARAddressBookBackup.m" into your project.
(ii) Copy/Include  "MessageUI.framework" & "AddressBook.framework" into your project.
That's it. Your done.


Also, the Example project illustrates on how to email the .vcf file.


Usage :

SARAddressBookBackup *addressBook = [[SARAddressBookBackup alloc]init];
addressBook.backupPath = [self applicationDocumentsDirectory];//(Optional). If not given, then the backup
// file is stored under the Documents directory.
__weak SARAddressBookBackup *addressBook_weak = addressBook;
__weak SARViewController *self_weak = self;
addressBook.backupCompletionStatusBlock = ^(NSString *status){
    if ( status == ACCESSDENIED) {
        NSLog(@"ACCESSDENIED : %@",ACCESSDENIED);
    }
    else if ( status == BACKUPFAILED) {
        NSLog(@"BACKUPFAILED : %@",BACKUPFAILED);
    }
    else if ( status == BACKUPSUCCESS) {
        NSLog(@"BACKUPSUCCESS : %@",BACKUPSUCCESS);
        NSLog(@"addressBook.backupPath : %@",addressBook_weak.backupPath);
        [NSTimer scheduledTimerWithTimeInterval:1.0 target:self_weak selector:@selector(emailBackup:) userInfo:addressBook_weak.backupPath repeats:NO];
    }
};
[addressBook backupContacts];