菜鸟教程小白 发表于 2022-12-11 19:38:27

ios - 联系人框架只增加了几个联系人


                                            <p><p>我正在使用 Contacts Framework 将所有联系人从我的 iPhone 抓取到我的应用程序。但它只获取少数联系人。这是我使用此代码的代码:</p>

<pre><code>//ios 9+
CNContactStore *store = [ init];
[store requestAccessForEntityType:CNEntityTypeContacts completionHandler:^(BOOL granted, NSError * _Nullable error) {
    if (granted == YES) {

      NSArray *keys = @;
      NSString *containerId = store.defaultContainerIdentifier;
      NSPredicate *predicate = ;
      NSError *error;
      NSArray *cnContacts = ;

   }
</code></pre></p>
                                    <br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
                                            <p><p>试试这个:</p>

<pre><code>    [store requestAccessForEntityType:CNEntityTypeContacts completionHandler:^(BOOL granted, NSError * _Nullable error) {

      if (granted == YES) {

            NSArray *keys = @;
            NSError *error;
            NSArray *allContainer = ;

            for (CNContainer *container in allContainer) {

                  NSPredicate *predicate = ;
                  NSArray *result = ;
                  ;
            }
      }
    }];
</code></pre></p>
                                   
                                                <p style="font-size: 20px;">关于ios - 联系人框架只增加了几个联系人,我们在Stack Overflow上找到一个类似的问题:
                                                        <a href="https://stackoverflow.com/questions/43884464/" rel="noreferrer noopener nofollow" style="color: red;">
                                                                https://stackoverflow.com/questions/43884464/
                                                        </a>
                                                </p>
                                       
页: [1]
查看完整版本: ios - 联系人框架只增加了几个联系人