2017-04-06 43 views
0
UIDocumentInteractionController *documentVc = [UIDocumentInteractionController interactionControllerWithURL:fileURL]; 

documentVc.delegate = self; 

if (![documentVc respondsToSelector:@selector(presentPreviewAnimated:)]) { 
    NSLog(@"can not open this file"); 
} else { 
    [documentVc presentPreviewAnimated:YES]; 
} 

當UIDocumentInteractionController無法打開文件時,我想知道如何提示用戶,該文件無法打開。任何想法?我如何知道UIDocumentInteractionController無法打開文件?

和我的代碼不起作用。

回答

0

[documentVc presentPreviewAnimated:YES]

這種方法具有一個返回值,以指示一個文件是否能夠顯示。

相關問題