打开第三方应用

2018-04-25  本文已影响0人  福将的逆袭

需要在真机上调试,例子中打开的是  doc文件,如果手机上装了WPS或者office套件,就能调用这些应用打开。

2.第三方APP调用自己的APP,打开文件

在info.plist中添加如下代码

NSString *str = [NSString stringWithContentsOfFile:self.filePath encoding:NSUTF8StringEncoding error:nil];

     NSURL *  fielPp = [NSURL fileURLWithPath:str];

        self.documentVC = [UIDocumentInteractionController interactionControllerWithURL:_fielPp];

        [self.documentVC setDelegate:self];

        BOOL canOpen =  [self.documentVC presentOpenInMenuFromRect:CGRectZero inView:self.view animated:YES];

       // 返回NO说明没有可以打开该文件的爱屁屁, 友情提示一下

        if (canOpen == NO) {

            [MBProgressHUD autoShowAndHideWithMessage:@"没有可打开的软件"];

    }

上一篇 下一篇

猜你喜欢

热点阅读