Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You are right, the AddressBook changed its Pasteboard behavior from former OS versions to Lion. Formerly the vCard data were directly stored in the pasteboard with type NSVCardPboardType. But also in Lion you can find all informations to read a dropped vCard.</p> <p>There are two ways to deal with a pasteboard. The 'direct' way and a 'dialog' way. (My words, not Apple's). In the direct way all data are put to the pasteboard, where the receiver finds them and can read them. Sometimes it is very time and space consuming, when the data are big as is very often with images or long text (RTFD with images). Therefore another way exists, which needs a small dialog between sender and receiver. The sender (of the drag operation) puts (nearly) no data to the pasteboard but promises to store the data somewhere in the filesystem. The receiver (of the drag operation) has to tell where this place (a folder) should be. The answer from the sender is then the name of the newly created file(s) so the receiver can read the data from this file. All this should be done in the method <code>-(BOOL)performDragOperation:(id &lt;NSDraggingInfo&gt;)sender</code> . But if the drop is done over a tableView, outLineView, browser etc. you need to implement another method. Search for <code>acceptDrop:</code> in the documentation. Essentially they do all the same.</p> <p>In your case (drop over a tableView) the following (pseudo-)code will (I hope so) do the job:</p> <pre><code>- (BOOL)tableView:(NSTableView *)aTableView acceptDrop:(id &lt; NSDraggingInfo &gt;)info row:(NSInteger)row dropOperation:(NSTableViewDropOperation)operation { NSPasteBoard *pb = [info draggingPasteboard]; NSArray *types = pb.types; if( ([types containsObject: NSVCardPboardType]) &amp;&amp; *data_exist for this type* ){ // read the data directly from here . . . . return YES; } if( [types containsObject:NSFilesPromisePboardType] ){ // create a place for the promised data NSString *destPath = NSTemporaryDirectory(); NSURL *destURL = [NSURL fileURLWithPath:destPath isDirectory:YES]; // let the sender know it // the sender answers with filenames (without the path) NSArray *fileNames = [sender namesOfPromisedFilesDroppedAtDestination:destURL]; if( fileNames == nil ) return NO; // Firefox likes to return nothing NSString *resultStr = [destPath stringByAppendingPathComponent:[fileNames objectAtIndex:0]]; // read the vCard data from here . . . . . return YES; } // search for other pbTypes or just return without success return NO; } </code></pre> <p>As you can see in your log of all types on the pasteBoard, the type <code>NSFilesPromisePboardType</code> (the internal name is <em>Apple files promise pasteboard type</em> ) has a nonempty propertyList which simply says that data are of type vcf (file suffix). To use this pbType is the new way AddressBook works. This is btw the preferred way to send data to the finder.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload