其它应用打开

将app中的pdf文件可以用其它应用打开如下图


首先声明对象

@property(retain, nonatomic) UIDocumentInteractionController *diController;



            self.diController = [UIDocumentInteractionController interactionControllerWithURL:filePath];

//            NSDictionary* dic = [NSDictionary dictionaryWithObject:@"fruit" forKey:@"tag"];

//            self.diController.annotation = dic;

            self.diController.delegate = self;

            if ([self.diController presentOptionsMenuFromRect:self.view.frame

                                                       inView:self.view animated:YES]){

            } else {

                [ApplicationInfo showToastWithMsg:@"沒有程序可以打开要分享的文件"];

            }

}