IKImageBrowserView:Drag&丢弃错误

时间:2013-09-30 13:25:07

标签: objective-c cocoa sandbox ikimagebrowserview pasteboard

我正在使用IKImageBrowserView并获取error described here。所以我应该使用NSURLs代替NSStrings /路径。我现在已经将所有内容都更改为NSURL,但仍然会出现同样的错误。我尝试使用IKImageBrowserNSURLRepresentationTypeNSURLPboardType,但这也不起作用。拖动照片时,控制台会一直说:

  

__ CFPasteboardIssueSandboxExtensionForPath:错误...

我的数据结构如下:

@implementation MyImageObject

- (void) setPath:(NSURL *) path{
    if(myPath != path){
        myPath = path;
    }
}

- (NSString *)  imageRepresentationType{
    return IKImageBrowserPathRepresentationType;
}

- (id)  imageRepresentation{
    return myPath;
}

- (NSURL *) imageUID{
    return myPath;
}

和imageBrowser writeItemsAtIndexes toPasteboard:

- (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];
}

所以有人知道我必须使用哪些类型或如何摆脱此错误消息?

0 个答案:

没有答案