美文网首页
打开第三方应用

打开第三方应用

作者: 福将的逆袭 | 来源:发表于2018-04-25 21:26 被阅读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:@"没有可打开的软件"];

        }

    相关文章

      网友评论

          本文标题:打开第三方应用

          本文链接:https://www.haomeiwen.com/subject/knculftx.html