• <small id='D1ogO'></small><noframes id='D1ogO'>

    • <bdo id='D1ogO'></bdo><ul id='D1ogO'></ul>

      <i id='D1ogO'><tr id='D1ogO'><dt id='D1ogO'><q id='D1ogO'><span id='D1ogO'><b id='D1ogO'><form id='D1ogO'><ins id='D1ogO'></ins><ul id='D1ogO'></ul><sub id='D1ogO'></sub></form><legend id='D1ogO'></legend><bdo id='D1ogO'><pre id='D1ogO'><center id='D1ogO'></center></pre></bdo></b><th id='D1ogO'></th></span></q></dt></tr></i><div id='D1ogO'><tfoot id='D1ogO'></tfoot><dl id='D1ogO'><fieldset id='D1ogO'></fieldset></dl></div>
      1. <tfoot id='D1ogO'></tfoot><legend id='D1ogO'><style id='D1ogO'><dir id='D1ogO'><q id='D1ogO'></q></dir></style></legend>

        在 iOS 4+ 中从 ABAddressBook 获取特定的 ABSource

        时间:2023-10-03

                <tbody id='n3jYd'></tbody>

                <small id='n3jYd'></small><noframes id='n3jYd'>

                <i id='n3jYd'><tr id='n3jYd'><dt id='n3jYd'><q id='n3jYd'><span id='n3jYd'><b id='n3jYd'><form id='n3jYd'><ins id='n3jYd'></ins><ul id='n3jYd'></ul><sub id='n3jYd'></sub></form><legend id='n3jYd'></legend><bdo id='n3jYd'><pre id='n3jYd'><center id='n3jYd'></center></pre></bdo></b><th id='n3jYd'></th></span></q></dt></tr></i><div id='n3jYd'><tfoot id='n3jYd'></tfoot><dl id='n3jYd'><fieldset id='n3jYd'></fieldset></dl></div>
              • <tfoot id='n3jYd'></tfoot>
                  <bdo id='n3jYd'></bdo><ul id='n3jYd'></ul>
                  <legend id='n3jYd'><style id='n3jYd'><dir id='n3jYd'><q id='n3jYd'></q></dir></style></legend>
                  本文介绍了在 iOS 4+ 中从 ABAddressBook 获取特定的 ABSource的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  有没有人举例说明如何在 iOS 4+ 中从 ABAddressBook 获取特定的 ABSource?

                  Does anyone have an example of how to obtain a specific ABSource from the ABAddressBook in iOS 4+?

                  推荐答案

                  iOS 4+ 提供了新的 API,允许从 ABAddressBook 中选择特定的 ABSource.这可能对某些操作有用,例如某些来源(例如 Exchange)不支持创建 ABGroup.

                  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).

                  并非所有源类型都支持组,更明显的是,Exchange 对组一无所知."- http://flavors.me/volonbolon#1a5/tumblr

                  "Not all source types support groups, more conspicuously, Exchange does not know anything about groups." - http://flavors.me/volonbolon#1a5/tumblr

                  附加的是利用新 API 获取特定类型源的函数,这些源可用于调用 ABGroupCreateInSource().

                  Attached are functions that leverage the new API to obtain sources of specific types which may be used in calls to ABGroupCreateInSource().

                  #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 < 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);
                  }
                  

                  这篇关于在 iOS 4+ 中从 ABAddressBook 获取特定的 ABSource的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:在 iOS4 中检测通话状态 下一篇:对 &lt;UITabBarController: 0x197870&gt; 的开始/结束外观转换的不平

                  相关文章

                • <tfoot id='bmUz9'></tfoot>
                  • <bdo id='bmUz9'></bdo><ul id='bmUz9'></ul>

                      <small id='bmUz9'></small><noframes id='bmUz9'>

                      <i id='bmUz9'><tr id='bmUz9'><dt id='bmUz9'><q id='bmUz9'><span id='bmUz9'><b id='bmUz9'><form id='bmUz9'><ins id='bmUz9'></ins><ul id='bmUz9'></ul><sub id='bmUz9'></sub></form><legend id='bmUz9'></legend><bdo id='bmUz9'><pre id='bmUz9'><center id='bmUz9'></center></pre></bdo></b><th id='bmUz9'></th></span></q></dt></tr></i><div id='bmUz9'><tfoot id='bmUz9'></tfoot><dl id='bmUz9'><fieldset id='bmUz9'></fieldset></dl></div>
                      <legend id='bmUz9'><style id='bmUz9'><dir id='bmUz9'><q id='bmUz9'></q></dir></style></legend>