Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/cocoa/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Objective c IKImageBrowserView:拖放错误_Objective C_Cocoa_Sandbox_Ikimagebrowserview_Pasteboard - Fatal编程技术网

Objective c IKImageBrowserView:拖放错误

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

我正在使用IKImageBrowserView并获取。所以我应该使用nsurl而不是NSStrings/path。我现在已经将所有内容都更改为NSURL,但仍然得到相同的错误。我试着使用IKImageBrowserNSURLRepresentationType和NSURLPboardType,但这也不起作用。拖动照片时,控制台会一直显示:

__CFPasteBoardIssuseAndBoxextensionForPath:路径错误

我的数据结构如下所示:

@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];
}
那么,有人知道我必须使用哪些类型,或者如何消除此错误消息吗