Wie bekomme ich Zählung von Menschen aus ExchangeGal-Quellen mit abaddressbookcopyarrayofallpeopleinSourceMwithsortoringing ()
-
16-11-2019 - |
Frage
Ich versuche, Menschen in drei Quellen zu erhalten (1 MobileMe-Quelle und 2 * ExchangeGal-Quellen) meines iOS 4-Adressbuchs.Kummer
Die NSLOG-Erklärung bringt immer 0 Personen nach ExchangeGal zurück, sondern gibt eine Zählung von Menschen für MobileMe an.Kummer
Nachdem Sie alle Quellen aus dem iOS-Adressbuch mithilfe von AbaddressBookCopyArrayofallSources (Adressbuch) erhalten, versuche ich die Quelle nach Quelle, um mehr Informationen für jede Quelle zu erstellen.
Ich benutze die abaddressbookcopyarrayofallpeopleinsourceMwithsortoration ordnungsgemäß?
Würde eine Zählung aller Personen in den verschiedenen Adressbuchquellen erwarten.
generasacodicetagpre.
edit FEB24:
Es sieht so aus, als ob der Code funktioniert, aber ich habe ein Problem, die Leute von Ehrgegnern zählen.
Hat Anyoune Menschen von ExchangeGal erfolgreich abgerufen?
MobileMe-Quelle berichtet eine Person, die zählt.
Hier ist das Protokoll von der Konsole:
generasacodicetagpre.
Lösung
Try Using:
ABRecordRef sourceWithType (ABSourceType mySourceType)
{
ABAddressBookRef addressBook = ABAddressBookCreate();
CFArrayRef sources = ABAddressBookCopyArrayOfAllSources(addressBook);
CFIndex sourceCount = CFArrayGetCount(sources);
ABRecordRef resultSource = NULL;
for (CFIndex i = 0 ; i < sourceCount; i++) {
ABRecordRef currentSource = CFArrayGetValueAtIndex(sources, i);
ABSourceType sourceType = [(NSNumber *)ABRecordCopyValue(currentSource, kABSourceTypeProperty) intValue];
if (mySourceType == sourceType) {
resultSource = currentSource;
break;
}
}
return resultSource;
}
ABRecordRef localSource()
{
return sourceWithType(kABSourceTypeLocal);
}
ABRecordRef exchangeSource()
{
return sourceWithType(kABSourceTypeExchange);
}
ABRecordRef mobileMeSource()
{
return sourceWithType(kABSourceTypeMobileMe);
}
You might find this helpful :abaddressbook-absource-and-absourcetype
Andere Tipps
Are the people you're expecting to return actually in your addressbook? You shouldn't expect ABAddressBookCopyArrayOfAllPeopleInSourceWithSortOrdering()
to return the entire GAL. That would be massive. You should only expect it to return a subset of ABAddressBookCopyArrayOfAllPeople()
.