I'm trying to preview my documents/pictures using QuickLook library. Everything was fine when I wanted to open the content in both ios7 & ios8. I want to change the name of the item found in the preview. Everything is fine on iOS7 but when I run the application on iOS8 there are problems.
This is my code :
-(void)startDownload{
// Download code here - after I set the QLPreviewController
QLPreviewController* lcontroller= [QLPreviewController new];
self.quickLookUrl = item.openUrl;
self.quickLookName = item.name;
lcontroller.dataSource = self;
[self presentViewController:lcontroller animated:NO completion:nil];
}
#pragma mark - Quicklook Delegate
- (NSInteger)numberOfPreviewItemsInPreviewController:(QLPreviewController *)controller{
return 1;
}
- (id<QLPreviewItem>)previewController:(QLPreviewController *)controller previewItemAtIndex:(NSInteger)index{
QLPreviewItemCustom *obj = [[QLPreviewItemCustom alloc] initWithTitle:self.quickLookName url:[NSURL fileURLWithPath:self.quickLookUrl]];
return obj;
}
QLPreviewItemCustom - QLPreviewItem details :
QLPreviewItemCustom.h
#import <Foundation/Foundation.h>
#import <QuickLook/QuickLook.h>
@interface QLPreviewItemCustom : NSObject <QLPreviewItem>
- (id) initWithTitle:(NSString*)title url:(NSURL*)url;
@end
QLPreviewItemCustom.m - details :
#import "QLPreviewItemCustom.h"
@implementation QLPreviewItemCustom
@synthesize previewItemTitle = _previewItemTitle;
@synthesize previewItemURL = _previewItemURL;
- (id) initWithTitle:(NSString*)title url:(NSURL*)url
{
self = [super init];
if (self != nil) {
_previewItemTitle = title;
_previewItemURL = url;
}
return self;
}
@end
When I run the project on iOS8 this is the result :
I have read the release notes about iOS8 GM (I was able to open PDF files in the application without any problem) : iOS8 GM Release Notes
At this point I do not know if it is still a problem with the new SDK or am I wrong in the development process. Can you help me with advice? I have not found other libraries to help me to preview the content of my items (pdf, jpg, excel, doc..).
Thanks in advance for your help !