1

我正在使用 IKImageBrowserView 并收到此处描述的错误。所以我应该使用NSURLs而不是NSStrings/paths。我现在已将所有内容更改为 NSURL,但仍然出现相同的错误。我尝试使用IKImageBrowserNSURLRepresentationTypeand NSURLPboardType,但这也不起作用。拖动照片时,控制台一直说:

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

那么有谁知道我必须使用哪些类型或如何摆脱此错误消息?

4

0 回答 0