Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7436587
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T10:15:48+00:00 2026-05-29T10:15:48+00:00

I’m working on an Objective-C app that is Mac OS X Lion only. I’m

  • 0

I’m working on an Objective-C app that is Mac OS X Lion only. I’m trying to accept drag & drops from Address Book. It looks like in Lion, Address Book vCard representations are not returning any data. Unfortunately I cannot test the code under a previous OS, though I had found sample code suggesting that it was possible before.

I setup my table to receive kUTTypeVCard like the docs suggest for 10.6+ (though NSVCardPboardType works, too) and I do receive the drop event. So to debug I setup a loop to output the data types and their values from the drop:

- (BOOL)tableView:(NSTableView *)aTableView acceptDrop:(id <NSDraggingInfo>)info row:(NSInteger)row dropOperation:(NSTableViewDropOperation)operation
{
    NSPasteboard *pb = [info draggingPasteboard];

    NSArray *types = pb.types;
    for (NSString *type in types)
    {
        NSLog(@" ");
        NSLog(@"%@:", type);
        NSLog(@"    property list = %@", [pb propertyListForType:type]);
        NSLog(@"    data = %@", [pb dataForType:type]);
        NSLog(@"    string = %@", [pb stringForType:type]);
    }
    NSLog(@" ");

    return YES;
}

The results are as follows:

2012-02-01 19:46:18.907 MyAppName[586:60b]  
2012-02-01 19:46:18.907 MyAppName[586:60b] dyn.ah62d4rv4gu8ycuwftb2gc5xeqzwfg3pqqzv1k4ptr3m1k6xmr3xyc6xwqf6zk8puqy:
2012-02-01 19:46:18.909 MyAppName[586:60b]     property list = (null)
2012-02-01 19:46:18.911 MyAppName[586:60b]     data = (null)
2012-02-01 19:46:18.912 MyAppName[586:60b]     string = (null)
2012-02-01 19:46:18.913 MyAppName[586:60b]  
2012-02-01 19:46:18.913 MyAppName[586:60b] ABExpandedSelectionStringArrayType:
2012-02-01 19:46:18.914 MyAppName[586:60b]     property list = (null)
2012-02-01 19:46:18.914 MyAppName[586:60b]     data = (null)
2012-02-01 19:46:18.915 MyAppName[586:60b]     string = (null)
2012-02-01 19:46:18.915 MyAppName[586:60b]  
2012-02-01 19:46:18.915 MyAppName[586:60b] dyn.ah62d4rv4gu8ycuwxqz0gn25yrf106y5ysmy0634bsm3gc8nytf2gn:
2012-02-01 19:46:18.917 MyAppName[586:60b]     property list = (null)
2012-02-01 19:46:18.918 MyAppName[586:60b]     data = (null)
2012-02-01 19:46:18.918 MyAppName[586:60b]     string = (null)
2012-02-01 19:46:18.918 MyAppName[586:60b]  
2012-02-01 19:46:18.919 MyAppName[586:60b] ABSelectionStringArrayType:
2012-02-01 19:46:18.919 MyAppName[586:60b]     property list = (null)
2012-02-01 19:46:18.921 MyAppName[586:60b]     data = (null)
2012-02-01 19:46:18.922 MyAppName[586:60b]     string = (null)
2012-02-01 19:46:18.922 MyAppName[586:60b]  
2012-02-01 19:46:18.922 MyAppName[586:60b] dyn.ah62d4rv4gu8yc6durvwwa3xmrvw1gkdusm1044pxqyuha2pxsvw0e55bsmwca7d3sbwu:
2012-02-01 19:46:18.922 MyAppName[586:60b]     property list = (
    vcf
)
2012-02-01 19:46:18.923 MyAppName[586:60b]     data = <3c3f786d 6c207665 7273696f 6e3d2231 2e302220 656e636f 64696e67 3d225554 462d3822 3f3e0a3c 21444f43 54595045 20706c69 73742050 55424c49 4320222d 2f2f4170 706c652f 2f445444 20504c49 53542031 2e302f2f 454e2220 22687474 703a2f2f 7777772e 6170706c 652e636f 6d2f4454 44732f50 726f7065 7274794c 6973742d 312e302e 64746422 3e0a3c70 6c697374 20766572 73696f6e 3d22312e 30223e0a 3c617272 61793e0a 093c7374 72696e67 3e766366 3c2f7374 72696e67 3e0a3c2f 61727261 793e0a3c 2f706c69 73743e0a>
2012-02-01 19:46:18.923 MyAppName[586:60b]     string = <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<array>
    <string>vcf</string>
</array>
</plist>
2012-02-01 19:46:18.923 MyAppName[586:60b]  
2012-02-01 19:46:18.923 MyAppName[586:60b] Apple files promise pasteboard type:
2012-02-01 19:46:18.923 MyAppName[586:60b]     property list = (
    vcf
)
2012-02-01 19:46:18.924 MyAppName[586:60b]     data = <3c3f786d 6c207665 7273696f 6e3d2231 2e302220 656e636f 64696e67 3d225554 462d3822 3f3e0a3c 21444f43 54595045 20706c69 73742050 55424c49 4320222d 2f2f4170 706c652f 2f445444 20504c49 53542031 2e302f2f 454e2220 22687474 703a2f2f 7777772e 6170706c 652e636f 6d2f4454 44732f50 726f7065 7274794c 6973742d 312e302e 64746422 3e0a3c70 6c697374 20766572 73696f6e 3d22312e 30223e0a 3c617272 61793e0a 093c7374 72696e67 3e766366 3c2f7374 72696e67 3e0a3c2f 61727261 793e0a3c 2f706c69 73743e0a>
2012-02-01 19:46:18.924 MyAppName[586:60b]     string = <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<array>
    <string>vcf</string>
</array>
</plist>
2012-02-01 19:46:18.924 MyAppName[586:60b]  
2012-02-01 19:46:18.925 MyAppName[586:60b] dyn.ah62d4rv4gu8ycuwuqz11a5dfnzeyk64uqm10c6xenv61a3k:
2012-02-01 19:46:18.925 MyAppName[586:60b]     property list = (
    "C9786D5F-157A-4A65-A95E-C61752D2B4E3:ABPerson"
)
2012-02-01 19:46:18.925 MyAppName[586:60b]     data = <3c3f786d 6c207665 7273696f 6e3d2231 2e302220 656e636f 64696e67 3d225554 462d3822 3f3e0a3c 21444f43 54595045 20706c69 73742050 55424c49 4320222d 2f2f4170 706c652f 2f445444 20504c49 53542031 2e302f2f 454e2220 22687474 703a2f2f 7777772e 6170706c 652e636f 6d2f4454 44732f50 726f7065 7274794c 6973742d 312e302e 64746422 3e0a3c70 6c697374 20766572 73696f6e 3d22312e 30223e0a 3c617272 61793e0a 093c7374 72696e67 3e433937 38364435 462d3135 37412d34 4136352d 41393545 2d433631 37353244 32423445 333a4142 50657273 6f6e3c2f 73747269 6e673e0a 3c2f6172 7261793e 0a3c2f70 6c697374 3e0a>
2012-02-01 19:46:18.926 MyAppName[586:60b]     string = <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<array>
    <string>C9786D5F-157A-4A65-A95E-C61752D2B4E3:ABPerson</string>
</array>
</plist>
2012-02-01 19:46:18.926 MyAppName[586:60b]  
2012-02-01 19:46:18.926 MyAppName[586:60b] ABPeopleUIDsPboardType:
2012-02-01 19:46:18.927 MyAppName[586:60b]     property list = (
    "C9786D5F-157A-4A65-A95E-C61752D2B4E3:ABPerson"
)
2012-02-01 19:46:18.927 MyAppName[586:60b]     data = <3c3f786d 6c207665 7273696f 6e3d2231 2e302220 656e636f 64696e67 3d225554 462d3822 3f3e0a3c 21444f43 54595045 20706c69 73742050 55424c49 4320222d 2f2f4170 706c652f 2f445444 20504c49 53542031 2e302f2f 454e2220 22687474 703a2f2f 7777772e 6170706c 652e636f 6d2f4454 44732f50 726f7065 7274794c 6973742d 312e302e 64746422 3e0a3c70 6c697374 20766572 73696f6e 3d22312e 30223e0a 3c617272 61793e0a 093c7374 72696e67 3e433937 38364435 462d3135 37412d34 4136352d 41393545 2d433631 37353244 32423445 333a4142 50657273 6f6e3c2f 73747269 6e673e0a 3c2f6172 7261793e 0a3c2f70 6c697374 3e0a>
2012-02-01 19:46:18.937 MyAppName[586:60b]     string = <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<array>
    <string>C9786D5F-157A-4A65-A95E-C61752D2B4E3:ABPerson</string>
</array>
</plist>
2012-02-01 19:46:18.937 MyAppName[586:60b]  
2012-02-01 19:46:18.937 MyAppName[586:60b] public.vcard:
2012-02-01 19:46:18.942 MyAppName[586:60b]     property list = (null)
2012-02-01 19:46:18.944 MyAppName[586:60b]     data = (null)
2012-02-01 19:46:18.945 MyAppName[586:60b]     string = (null)
2012-02-01 19:46:18.945 MyAppName[586:60b]  
2012-02-01 19:46:18.945 MyAppName[586:60b] Apple VCard pasteboard type:
2012-02-01 19:46:18.945 MyAppName[586:60b]     property list = (null)
2012-02-01 19:46:18.946 MyAppName[586:60b]     data = (null)
2012-02-01 19:46:18.946 MyAppName[586:60b]     string = (null)
2012-02-01 19:46:18.948 MyAppName[586:60b]  
2012-02-01 19:46:18.949 MyAppName[586:60b] dyn.ah62d4rv4gu8z82xqqz1gk3penm11swpsqvw1u3px:
2012-02-01 19:46:18.949 MyAppName[586:60b]     property list = (null)
2012-02-01 19:46:18.949 MyAppName[586:60b]     data = <040b7374 7265616d 74797065 6481e803 84014084 8484114e 534d7574 61626c65 496e6465 78536574 0084840a 4e53496e 64657853 65740084 84084e53 4f626a65 63740085 84014901 96817c01 960186>
2012-02-01 19:46:18.949 MyAppName[586:60b]     string = (null)
2012-02-01 19:46:18.949 MyAppName[586:60b]  
2012-02-01 19:46:18.950 MyAppName[586:60b] _blendedRowIndexes:
2012-02-01 19:46:18.950 MyAppName[586:60b]     property list = (null)
2012-02-01 19:46:18.950 MyAppName[586:60b]     data = <040b7374 7265616d 74797065 6481e803 84014084 8484114e 534d7574 61626c65 496e6465 78536574 0084840a 4e53496e 64657853 65740084 84084e53 4f626a65 63740085 84014901 96817c01 960186>
2012-02-01 19:46:18.950 MyAppName[586:60b]     string = (null)
2012-02-01 19:46:18.950 MyAppName[586:60b]  
2012-02-01 19:46:18.950 MyAppName[586:60b] com.apple.pasteboard.promised-file-content-type:
2012-02-01 19:46:18.951 MyAppName[586:60b]     property list = public.vcard
2012-02-01 19:46:18.951 MyAppName[586:60b]     data = <7075626c 69632e76 63617264>
2012-02-01 19:46:18.951 MyAppName[586:60b]     string = public.vcard
2012-02-01 19:46:18.952 MyAppName[586:60b]  
2012-02-01 19:46:18.952 MyAppName[586:60b] com.apple.pasteboard.promised-file-url:
2012-02-01 19:46:18.954 MyAppName[586:60b]     property list = (null)
2012-02-01 19:46:18.954 MyAppName[586:60b]     data = <>
2012-02-01 19:46:18.954 MyAppName[586:60b]     string = 
2012-02-01 19:46:18.955 MyAppName[586:60b]  
2012-02-01 19:46:18.955 MyAppName[586:60b] dyn.ah62d4rv4gu8y6y4usm1044pxqzb085xyqz1hk64uqm10c6xenv61a3k:
2012-02-01 19:46:18.955 MyAppName[586:60b]     property list = (null)
2012-02-01 19:46:18.956 MyAppName[586:60b]     data = <>
2012-02-01 19:46:18.956 MyAppName[586:60b]     string = 
2012-02-01 19:46:18.956 MyAppName[586:60b]  
2012-02-01 19:46:18.956 MyAppName[586:60b] NSPromiseContentsPboardType:
2012-02-01 19:46:18.956 MyAppName[586:60b]     property list = (null)
2012-02-01 19:46:18.957 MyAppName[586:60b]     data = <>
2012-02-01 19:46:18.957 MyAppName[586:60b]     string = 
2012-02-01 19:46:18.957 MyAppName[586:60b] 

Most of the types looks like private Address Book data types. But you can see that the vCard representations are null. And I’m thinking that even if I used ABPeopleUIDsPboardType, it would get rejected from the App Store because it’s not available in any header file.

Any suggestion in how to handle a drag & drop from Address Book under Lion?

Thanks.

* Edit 2/5/12 *

Tried researching promised drags and promised contents, but still coming up empty:

- (BOOL)tableView:(NSTableView *)aTableView acceptDrop:(id <NSDraggingInfo>)info row:(NSInteger)row dropOperation:(NSTableViewDropOperation)operation
{
    NSPasteboard *pb = [info draggingPasteboard];

    // Supposed to call this before readFileContentsType:toFile: for some reason
    NSArray *types = pb.types;

    NSString *destPath = NSTemporaryDirectory();
    NSURL *destURL = [NSURL fileURLWithPath:destPath isDirectory:YES];
    NSArray *fileNames = [info namesOfPromisedFilesDroppedAtDestination:destURL];
    NSLog(@"fileNames = %@", fileNames);

    NSString *afile = [pb readFileContentsType:nil toFile:@"random_filename"];
    // Tried with (NSString *)kUTTypeVCard as well, same results
    NSLog(@"afile = %@", afile);
    // What do I do with this result?
    NSString *card = [NSString stringWithContentsOfFile:afile];
    NSLog(@"card = %@", card);

    NSFileWrapper *wrapper = [pb readFileWrapper];
    NSLog(@"wrapper = %@", wrapper);

    return YES;
}

Results:

2012-02-05 12:36:58.419 MyAppName[3650:60b] fileNames = (null)
2012-02-05 12:36:58.419 MyAppName[3650:60b] afile = random_filename
2012-02-05 12:36:58.419 MyAppName[3650:60b] card = (null)
2012-02-05 12:36:58.420 MyAppName[3650:60b] wrapper = (null)
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T10:15:50+00:00Added an answer on May 29, 2026 at 10:15 am

    I do not know why you had no success, but I have a question: Did you register your tableView for NSFilesPromisePboardType ? Otherwise it doesn’t work!
    I will now show a code snippet from one of my apps which is tested and which works:

    - (BOOL)  tableView:(NSTableView *)aTableView
             acceptDrop:(id <NSDraggingInfo>)info
                    row:(NSInteger)row
          dropOperation:(NSTableViewDropOperation)operation
    {
        NSPasteboard *pboard = [info draggingPasteboard];
        NSArray *types = pboard.types;
    
        if( [types containsObject:NSFilesPromisePboardType] ){
            NSString *destPath = NSTemporaryDirectory();  // or whatever you want
            NSURL *destURL = [NSURL fileURLWithPath:destPath isDirectory:YES];
            NSLog(@"destURL %@", destURL);
            NSArray *fileNames = [info namesOfPromisedFilesDroppedAtDestination:destURL];
            NSLog(@"fileNames %@", fileNames);
            if( fileNames == nil ) return NO;
            NSString *resultPath = [destPath stringByAppendingPathComponent:[fileNames objectAtIndex:0]];
            NSLog(@"resultPath %@", resultPath);
            // read the vCard data from here
            NSString *vCard = [NSString stringWithContentsOfFile:resultPath
                                                        encoding:NSASCIIStringEncoding
                                                           error:NULL];
            NSLog(@"vCard =\n%@", vCard);
            return YES;
        }
        return NO;
    }
    

    The test output is;

    destURL file://localhost/var/folders/j2/78r9kp_d08gc52z04w2dwkv80000gn/T/
    fileNames (
        "Heinrich Giesen 2.vcf"
    )
    resultPath /var/folders/j2/78r9kp_d08gc52z04w2dwkv80000gn/T/Heinrich Giesen 2.vcf
    vCard =
    BEGIN:VCAR
    VERSION:3.0
    

    . . . and so on. ending with

    END:VCARD
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I'm trying to create an if statement in PHP that prevents a single post
I'm working with an upstream system that sometimes sends me text destined for HTML/XML
That's pretty much it. I'm using Nokogiri to scrape a web page what has
For some reason, after submitting a string like this Jack’s Spindle from a text
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.