You are here

initWithUrl

-(id) initWithUrl:(NSURL *)url - Creates an instance of SkyVaultContentFile with the local file url. The initializer creates a copy of the file in the temporary folder of the app. The initializer will attempt to deduce the mime type from the pathname (extension) - or set to nil if no match is found.

initWithUrl

-(id) initWithUrl:(NSURL *)url - Creates an instance of SkyVaultContentFile with the local file url. The initializer creates a copy of the file in the temporary folder of the app. The initializer will attempt to deduce the mime type from the pathname (extension) - or set to nil if no match is found.

Parameters

(NSURL *) url
The local file URL.

Returns

(void)

Example


/**
 loadDocumentContent - downloads the document content and shows it in a Preview. 
 This is activated when the user clicks on the download button in the
 tool bar of the Sample app
 */
- (void) loadDocumentContent
{
    self.documentService = [[AlfrescoDocumentFolderService alloc] initWithSession:self.session];
    self.progressView.hidden = NO;
    self.progressView.progress = 0.0;
    __weak DocumentViewController *weakSelf = self;
    if(nil != self.session && self.document != nil)
    {
        [self.documentService retrieveContentOfDocument:self.document
                                        completionBlock:^(AlfrescoContentFile *contentFile, NSError *error){
             if (nil == contentFile) 
             {
                 [weakSelf showFailureAlert:@"error_downloading_document"];
             }
             else 
             {
                 weakSelf.progressView.progress = 1.0;
                 weakSelf.documentPreviewItem = [[BasicPreviewItem alloc] initWithUrl:contentFile.fileUrl andTitle:self.document.name];
                 QLPreviewController *previewController = [[QLPreviewController alloc] init];
                 
                 //setting the datasource property to self
                 previewController.dataSource = self;
                 
                 //pushing the QLPreviewController to the navigation stack
                 [[weakSelf navigationController] pushViewController:previewController animated:YES];
                 [weakSelf.tableView reloadSections:[NSIndexSet indexSetWithIndex:1] withRowAnimation:UITableViewRowAnimationNone];
             }
             weakSelf.progressView.hidden = YES;
             [weakSelf.activityIndicator stopAnimating];
         } 
                                          progressBlock:^(NSInteger bytesDownloaded, NSInteger bytesTotal)
         {
             weakSelf.progressView.progress = (float)bytesDownloaded/(float)bytesTotal;
         }];
    }
}

        

initWithUrl

-(id) initWithUrl:(NSURL *)url mimeType:(NSString *)mimeType - Creates an instance of SkyVaultContentFile with the local file url. The initializer creates a copy of the file in the temporary folder of the app. This version passes in the mime type.

Parameters

(NSURL *) url
The local file URL.
(NSString *) mimeType
The mime type of the content.

Returns

(void)

Example