Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>iOS 4+ provides new API that allows one to select a specific ABSource from the ABAddressBook. This may be useful as some operations, e.g. creating an ABGroup, are not supported in some sources (i.e. Exchange).</p> <p>"Not all source types support groups, more conspicuously, Exchange does not know anything about groups." - <a href="http://flavors.me/volonbolon#1a5/tumblr" rel="noreferrer">http://flavors.me/volonbolon#1a5/tumblr</a></p> <p>Attached are functions that leverage the new API to obtain sources of specific types which may be used in calls to ABGroupCreateInSource().</p> <pre><code>#define CFRELEASE_AND_NIL(x) CFRelease(x); x=nil; ABRecordRef sourceWithType (ABSourceType mySourceType) { ABAddressBookRef addressBook = ABAddressBookCreate(); CFArrayRef sources = ABAddressBookCopyArrayOfAllSources(addressBook); CFIndex sourceCount = CFArrayGetCount(sources); ABRecordRef resultSource = NULL; for (CFIndex i = 0 ; i &lt; sourceCount; i++) { ABRecordRef currentSource = CFArrayGetValueAtIndex(sources, i); CFTypeRef sourceType = ABRecordCopyValue(currentSource, kABSourceTypeProperty); BOOL isMatch = mySourceType == [(NSNumber *)sourceType intValue]; CFRELEASE_AND_NIL(sourceType); if (isMatch) { resultSource = currentSource; break; } } CFRELEASE_AND_NIL(addressBook); CFRELEASE_AND_NIL(sources); return resultSource; } ABRecordRef localSource() { return sourceWithType(kABSourceTypeLocal); } ABRecordRef exchangeSource() { return sourceWithType(kABSourceTypeExchange); } ABRecordRef mobileMeSource() { return sourceWithType(kABSourceTypeMobileMe); } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload