using an iPhone 6 running iOS 8.2
I added a gmail account via the os settings, and the contacts (~350) for gmail show up in my contact list.
I also added 3 new contacts directly via the phone.
If I try to programtically retrieve all contacts via objective-c they all come back
ABAddressBookRef addressBookRef = ABAddressBookCreateWithOptions(NULL, nil);
NSArray *allContacts = (__bridge_transfer NSArray *)ABAddressBookCopyArrayOfAllPeople(addressBookRef);
If I try to get them with a sort order [via this question], only the 3 Records I added via the phone show up. The gmail ones do not return.
ABAddressBookRef addressBookRef = ABAddressBookCreateWithOptions(NULL, nil);
ABRecordRef source = ABAddressBookCopyDefaultSource(addressBookRef);
NSArray *sortedContacts = (__bridge_transfer NSArray *)ABAddressBookCopyArrayOfAllPeopleInSourceWithSortOrdering(addressBookRef, source, kABPersonSortByFirstName);
Edit:It does not matter if i sort by first name or last name, the same 3 records come back.
Am I doing something incorrect, or do I need to somehow trigger an index on the gmail Records?
Edit 2: _bridge to __bridge_transfer