Objective c IKImageBrowserView:拖放错误
我正在使用IKImageBrowserView并获取。所以我应该使用nsurl而不是NSStrings/path。我现在已经将所有内容都更改为NSURL,但仍然得到相同的错误。我试着使用IKImageBrowserNSURLRepresentationType和NSURLPboardType,但这也不起作用。拖动照片时,控制台会一直显示: __CFPasteBoardIssuseAndBoxextensionForPath:路径错误 我的数据结构如下所示:Objective c IKImageBrowserView:拖放错误,objective-c,cocoa,sandbox,ikimagebrowserview,pasteboard,Objective C,Cocoa,Sandbox,Ikimagebrowserview,Pasteboard,我正在使用IKImageBrowserView并获取。所以我应该使用nsurl而不是NSStrings/path。我现在已经将所有内容都更改为NSURL,但仍然得到相同的错误。我试着使用IKImageBrowserNSURLRepresentationType和NSURLPboardType,但这也不起作用。拖动照片时,控制台会一直显示: __CFPasteBoardIssuseAndBoxextensionForPath:路径错误 我的数据结构如下所示: @implementation MyI
@implementation MyImageObject
- (void) setPath:(NSURL *) path{
if(myPath != path){
myPath = path;
}
}
- (NSString *) imageRepresentationType{
return IKImageBrowserPathRepresentationType;
}
- (id) imageRepresentation{
return myPath;
}
- (NSURL *) imageUID{
return myPath;
}
并将图像浏览器写入到粘贴板:
- (NSUInteger) imageBrowser:(IKImageBrowserView *) aBrowser writeItemsAtIndexes:(NSIndexSet *) itemIndexes toPasteboard: (NSPasteboard *)pasteboard {
NSUInteger index;
//instantiate an array to store paths
NSMutableArray *filesArray = [NSMutableArray array];
//for each index...
for(index = [itemIndexes firstIndex]; index != NSNotFound; index = [itemIndexes indexGreaterThanIndex:index]){
//...get the path you want to add to the pasteboard
id myDatasourceItem = [myImages objectAtIndex:index];
//add it to your array
[filesArray addObject:[myDatasourceItem imageUID]];
}
//declare the pasteboard will contain paths
[pasteboard declareTypes:[NSArray arrayWithObjects:NSFilenamesPboardType,nil] owner:self];
[pasteboard writeObjects:filesArray];
//return the number of items added to the pasteboard
return [filesArray count];
}
那么,有人知道我必须使用哪些类型,或者如何消除此错误消息吗