我正在开发一个应用程序来将整个地址簿备份到亚马逊S3中,但我无法找到任何直接的iPhone API来获取整个地址簿到任何数据结构中。访问整个Iphone地址簿
我尝试下面的代码,写地址簿数组到一个文件中的文件目录
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *addressPath = [[paths objectAtIndex:0] stringByAppendingPathComponent:@"AddressBook.plist"];
ABAddressBookRef addressBook = ABAddressBookCreate();
NSMutableArray *allPeople = [[[(NSArray*) ABAddressBookCopyArrayOfAllPeople(addressBook)autorelease]mutableCopy]autorelease];
[allPeople writeToFile:addressPath atomically:YES];
但问题是文件没有在文件目录中创建得到....
任何建议表示赞赏....提前
谢谢...
感谢您的回复....是的,唯一的办法是遍历整个地址簿 – Fedrick 2010-06-17 18:35:06