• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
AddressBook Woes
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

AddressBook Woes


  • Subject: AddressBook Woes
  • From: Daniel Todd Currie <email@hidden>
  • Date: Fri, 15 Oct 2004 15:09:55 +0900

I'm having some trouble getting data out of my ABPerson pasteboard drop. I use the following code in the -performDragOperation method:

ABPerson *droppedPerson = [[ABPerson alloc] initWithVCardRepresentation:[pboard dataForType:NSVCardPboardType]];
NSString *nameString = [NSString stringWithFormat:@"%@ %@", [droppedPerson valueForProperty:kABFirstNameProperty], [droppedPerson valueForProperty:kABLastNameProperty]];

newComponent = [[NSMutableDictionary alloc] initWithObjectsAndKeys:
[droppedPerson uniqueId], @"id",
nameString, @"name",
[NSDate date], @"dateAdded",
[droppedPerson valueForProperty:kABCreationDateProperty], @"creationDate",
[droppedPerson valueForProperty:kABModificationDateProperty], @"modifiedDate",
@"ABPeopleUIDsPboardType", @"type", nil];

NSLog(@"newComponent = %@", newComponent);

Which returns the following run log:

2004-10-15 14:55:43.359 myApp[7051] newComponent = <CFDictionary 0x38de90 [0xa01900e0]>{type = mutable, count = 4, capacity = 4, pairs = (
0 : <CFString 0x2d5054 [0xa01900e0]>{contents = "id"} = <CFString 0x38a160 [0xa01900e0]>{contents = "D9CAD3F6-1E6E-11D9-8299-000D93C0D672:ABPerson"}
1 : <CFString 0x2d5064 [0xa01900e0]>{contents = "name"} = <CFString 0x38d730 [0xa01900e0]>{contents = "Anonymous Somebody"}
2 : <CFString 0x2d5074 [0xa01900e0]>{contents = "dateAdded"} = <CFDate 0x38ec50 [0xa01900e0]>{time = 119512543}
3 : <CFString 0x2d5084 [0xa01900e0]>{contents = "creationDate"} = 2004-10-15 14:55:43 +0900
)}

Funny, the creation date is exactly the same second that I retrieved the address book data (which is actually false). And then the dictionary didn't get filled because kABModificationDateProperty returned nil--I've checked that this is the reason. I've also checked the records using [[ABAddressBook sharedAddressBook] people], and the creation/modification dates are there; I'm just not getting them for some reason.

And then there's the problem with the "unique" ID. I dragged the same person into my app on two separate launches of the app, and I got significantly different IDs:

2004-10-15 14:45:54.339 myApp[7006] ABPerson = 664F0889-1E6D-11D9-943E-000D93C0D672:ABPerson
2004-10-15 14:45:54.351 myApp[7006] ABPerson = 7AA8053C-1E6D-11D9-9C41-000D93C0D672:ABPerson

What is going on? Has anyone successfully recovered these data? I know I'm not screwing it up completely, since I retrieve the ABPerson name correctly.

-- DTC

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden
  • Follow-Ups:
    • Re: AddressBook Woes
      • From: Nick Zitzmann <email@hidden>
  • Prev by Date: Re: Setting Document Icon
  • Next by Date: Re: AddressBook Woes
  • Previous by thread: -[NSUserDefaultsController save:]
  • Next by thread: Re: AddressBook Woes
  • Index(es):
    • Date
    • Thread