Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Open a file without extension with QLPreviewController or UIDocumentInteractionController

Is there a way to open a file with QLPreviewController or UIDocumentInteractionController, knowing its UTI, but without a file extension in the NSURL? Thanks for your help!

like image 724
Martin Avatar asked Jan 15 '23 17:01

Martin


1 Answers

I've just found another way to deal with it. Implement an item with the following properties:

@interface QuickLookPreviewItem : NSObject <QLPreviewItem>
@property (nonatomic, strong) NSURL *url;
@property (nonatomic, strong) NSString *title;
@property (nonatomic, strong) NSString *uti;
@end

@implementation QuickLookPreviewItem
- (NSString *)previewItemTitle { return self.title; }
- (NSURL *)previewItemURL { return self.url; }
- (NSString *)previewItemContentType { return self.uti; }
@end

Though it's not clear that it works that way in the documentation.

like image 69
Martin Avatar answered May 16 '23 04:05

Martin