0

Why is following code failed?

NSPasteboardItem* pasteboard_item = [NSPasteboardItem new];
id<NSPasteboardWriting> temp_obj = pasteboard_item;

I am newbie in Objective-c, but as I understand, NSPasteboardItem conforms NSPasteboardWriting protocol and such assignment should be allowed.

Xcode says:

Cannot initialize a variable of type id with lvalue of type 'NSPasteboardItem*'

Note: NSPasteboardItem is the class from AppKit to work with NSPasteBoard

Rob
  • 415,655
  • 72
  • 787
  • 1,044
Alex Aparin
  • 4,393
  • 5
  • 25
  • 51

0 Answers0