GithubHelp home page GithubHelp logo

Duplicate contacts about apaddressbook HOT 19 OPEN

alterplay avatar alterplay commented on June 2, 2024
Duplicate contacts

from apaddressbook.

Comments (19)

callbacknull avatar callbacknull commented on June 2, 2024

That looks right - I haven't familiarized myself with swift but I literally just wrote the same thing in obj-c yesterday (I use DTTableManager too) with no issues.

Have you checked the contacts array in the debugger before you add it to the memoryStorage?

from apaddressbook.

nelsongc avatar nelsongc commented on June 2, 2024

the list of contacts is right, but after this instruction

self.memoryStorage().addItems(contacts)

it appears duplicate contacts in the tableview

from apaddressbook.

callbacknull avatar callbacknull commented on June 2, 2024

It sounds like your issue is with DTTableViewManager then.

from apaddressbook.

nelsongc avatar nelsongc commented on June 2, 2024

the version of DTTableViewManager is (3.0.1), what version do I have to use?

from apaddressbook.

callbacknull avatar callbacknull commented on June 2, 2024

What exactly is your cell? It sounds like you probably want a customized cell - but it looks like your registering UITableViewCell as your cell class?

For custom cells to work properly in DTTableViewManager you need to either subclass DTTableViewCell or add the DTModelTransfer protocol to your cell and implement the updateWithModel: method. Check out the Examples directory in the github repo

from apaddressbook.

funkyboy avatar funkyboy commented on June 2, 2024

I am having the same issue, duplicated contacts. I suspect this is related to the fact that my contacts on the device are "linked". Those that appear twice are in fact linked to both iCloud and iPhone.
The array in loadContacts: already returns duplications, so it's not an issue with the way I populate my table view.
I had to use an NSSet like this

      NSMutableSet *tmp = [NSMutableSet set];
      for (APContact *c in contacts) {
        NSString *name = c.compositeName;
        if (name == nil) {
          name = @"";
        }
        for (NSString *s in c.phones) {
          NSString *res = [s stripPhoneNumber];
          ShareContact *c = [[ShareContact alloc] initWithName:name andPhone:res];
          [tmp addObject:c];
        }
      }

and override both isEqual: and hash in my custom class to have a correct detection of uniques in the set.

HTH

from apaddressbook.

smasry avatar smasry commented on June 2, 2024

I was noticing the same issue. Due to linked contacts with iCloud

from apaddressbook.

emptyway avatar emptyway commented on June 2, 2024

I believe this issue is a duplicate of #18

from apaddressbook.

belkevich avatar belkevich commented on June 2, 2024

Please, provide the way to reproduce duplicated contact. What exactly, I should add in iphone's address book to have duplicated contacts?

from apaddressbook.

emptyway avatar emptyway commented on June 2, 2024

@belkevich Go to your contact list and Edit an existing contact. At the bottom you will see an option as + Link Contacts press it and link to another contact. After this operation, these two contacts are linked and merged, and you will see it as 1 contact on your phone book. But when fetching with APAddressBook you will see it as separated.

from apaddressbook.

belkevich avatar belkevich commented on June 2, 2024

Thank you very much! I'll check it

from apaddressbook.

belkevich avatar belkevich commented on June 2, 2024

So, what is the right behavior? What do you think?

from apaddressbook.

emptyway avatar emptyway commented on June 2, 2024

IMHO APAddressBook should returns the same contact list as Contacts App. Any duplicated contact still can be retrieved with APContactFieldLinkedRecordIDs if you want to use it.

Since APContactFieldLinkedRecordIDs only retrieve the linked RecordIDs, a nice to have solution is to add a APContactFieldLinkedRecordContacts flag to pre-populate the linked APContacts into an array.

from apaddressbook.

lteti77 avatar lteti77 commented on June 2, 2024

I'm having the same problem... No solution?

from apaddressbook.

belkevich avatar belkevich commented on June 2, 2024

@lteti77

  1. is all contacts duplicated or just linked contacts?
  2. does Example app have same issue?
  3. please, share the code

from apaddressbook.

lteti77 avatar lteti77 commented on June 2, 2024

the linked contacts are duplicated. i haven't tested the example app, yet...

from apaddressbook.

belkevich avatar belkevich commented on June 2, 2024

@lteti77
I've created 2 contacts aaa and bbb and linked bbb into aaa. So, I see only aaa in Contacts.app. But Example.app shows me both aaa and bbb. Is that your problem?

from apaddressbook.

lteti77 avatar lteti77 commented on June 2, 2024

yes, it is. In my code i fixed it by iterating the contatcts and checking if each contacts has some linked contacts. In that case, i remove them from the list.

from apaddressbook.

belkevich avatar belkevich commented on June 2, 2024

@lteti77 see this discussion. If you have solution, please let me know.

from apaddressbook.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.