I'm trying to to paste something to the generalPasteboard but I keep getting some warnings because I'm using 10.6 coding in my 10.5 app. Can someone please fix this code to make it compile for 10.5 or earlier versions of OS X. Thanks
NSString *areacode = @"774";
NSPasteboard *pasteb开发者_StackOverflowoard = [NSPasteboard generalPasteboard];
[pasteboard clearContents];
NSArray *copiedObjects = [NSArray arrayWithObject:[NSString stringWithFormat:@"%@%@", areacode, phone]];
[pasteboard writeObjects:copiedObjects];
Right now I'm getting this warning message "NSPasteboard may not respond to -clearContents and writeObjects"
The pre-Snow-Leopard way to interact with a pasteboard was to declare the types you're going to put on it, then (optionally) put data on the pasteboard for those types. If you skip the latter step, then, as the current owner of the pasteboard, the pasteboard will call you back when somebody requests data for a type you didn't already provide data for.
See the documentation for further info.
精彩评论