在授权访问地址簿之后,将用户联系人存储在NSMutablearrays中

我在我的viewWillAppear:使用这个viewWillAppear:要求用户的权限/访问(如苹果要求)到他们的地址簿。 当他们允许访问时,他们可以进入“邀请”页面,在那里他们可以浏览(他们自己的)已经有我的应用程序上的现有帐户的联系人。 基本上,我只是要把他们的联系人,把它放到一个UITableView 。 所以,我必须得到他们所有的联系人,并将其添加到NSMutableArraytypes的数组中。 在下面的代码,它说:“/ /添加所有的用户联系到arrays”我需要一些代码。 我放什么?

 - (void)viewWillAppear:(BOOL)animated { // Request authorization to Address Book ABAddressBookRef addressBookRef = ABAddressBookCreateWithOptions(NULL, NULL); if (ABAddressBookGetAuthorizationStatus() == kABAuthorizationStatusNotDetermined) { ABAddressBookRequestAccessWithCompletion(addressBookRef, ^(bool granted, CFErrorRef error) { if (granted) { // First time access has been granted, add user's contacts to array // ADD ALL OF USERS CONTACTS TO ARRAY HERE } else { // User denied access // Display an alert telling user that they must allow access in order to proceed to "invites" page } }); } else if (ABAddressBookGetAuthorizationStatus() == kABAuthorizationStatusAuthorized) { // The user has previously given access, grab all contacts // ADD ALL OF USERS CONTACTS TO ARRAY HERE } else { // The user has previously denied access // Display an alert telling user that they must allow access in order to proceed to "invites" page } } 

你想要ABAddressBookCopyArrayOfAllPeople() 。