4
votes

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!

2

2 Answers

9
votes

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.

0
votes

add the file extension to the path while quick-looking it :) before push => add extension after pop => remove it again