Re: [SOLVED} QLPreviewPanel (how to supply default application url?)
Re: [SOLVED} QLPreviewPanel (how to supply default application url?)
- Subject: Re: [SOLVED} QLPreviewPanel (how to supply default application url?)
- From: email@hidden
- Date: Mon, 30 May 2016 21:00:48 +0900
I can't tell you how many times I've done the same.
It's easy to forget to use the fileURL methods.
Sent from my iPhone
> On May 30, 2016, at 8:15 PM, sqwarqDev <email@hidden> wrote:
>
> Got it. Should have been using fileURLWithPath.
>
> Thanks to dangerWill…I hadn’t posted the code I wouldn’t have spotted that!!
>
>
>> On 30 May 2016, at 18:08, sqwarqDev <email@hidden> wrote:
>>
>>
>>> On 30 May 2016, at 17:42, email@hidden wrote:
>>>
>>> Did you include the code?
>>
>> There’s only two methods for the datasource. Mine look like this:
>>
>>
>> #pragma mark - QLPreviewPanelDataSource
>>
>> - (NSInteger)numberOfPreviewItemsInPreviewPanel:(QLPreviewPanel *)panel
>> {
>> return [_arrayController selectedObjects].count; // returns ‘1'
>> }
>>
>> - (id <QLPreviewItem>)previewPanel:(QLPreviewPanel *)panel previewItemAtIndex:(NSInteger)index
>> {
>> NSArray *pathArray = [[_arrayController selectedObjects] valueForKey:@"Path"];
>> NSString *pathString = pathArray[0];
>> NSURL *previewPath = [[NSURL URLWithString:pathString] absoluteURL];
>> return previewPath; //returns ‘Users/phil/Documents/sample.txt'
>> }
>>
>>
>>
>> Best
>>
>>
>> Phil
>>
>>
>>
>>
>>> Sent from my iPhone
>>>
>>>> On May 30, 2016, at 7:20 PM, sqwarqDev <email@hidden <mailto:email@hidden>> wrote:
>>>>
>>>> Hoping someone can get me over the final hurdle…
>>>>
>>>> I have an NSTableView and I want the user to be able to hit the space bar to invoke a QuickLook preview of the selected item. These items are not custom objects, just regular text files.
>>>>
>>>> I’m following the sample code provided by Apple in QuickLookDownloader as my guide (see: https://developer.apple.com/library/mac/samplecode/QuickLookDownloader/Introduction/Intro.html)
>>>>
>>>> I’ve got everything up and running in the sense of, yes, I can hit the space bar, a preview panel pops up and shows my item’s title and an icon (the wrong icon, but that’s not my worry, yet). What it doesn’t show is a preview of the text file.
>>>>
>>>> In the log I see this message:
>>>>
>>>> [QL] LSCopyDefaultApplicationURLForURL for /Users/phil/Documents/sample.txt returned error Error Domain=NSOSStatusErrorDomain Code=-50 "paramErr: error in user parameter list”
>>>>
>>>> My question is where in my code do I provide this parameter? I don’t see it given in any of the methods in the QuickLookDownloader source.
>>>>
>>>>
>>>> TIA
>>>>
>>>>
>>>> Best
>>>>
>>>>
>>>> Phil
>>>>
>>>> _______________________________________________
>>>>
>>>> Cocoa-dev mailing list (email@hidden)
>>>>
>>>> Please do not post admin requests or moderator comments to the list.
>>>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>>>>
>>>> Help/Unsubscribe/Update your Subscription:
>>>>
>>>> This email sent to email@hidden <mailto:email@hidden>
>> _______________________________________________
>>
>> Cocoa-dev mailing list (email@hidden)
>>
>> Please do not post admin requests or moderator comments to the list.
>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>>
>> Help/Unsubscribe/Update your Subscription:
>>
>> This email sent to email@hidden
>
>
> _______________________________________________
>
> Cocoa-dev mailing list (email@hidden)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden