我正在尝试调用外部应用程序,例如Numbers(.numbers)或Safari(.htm)。我已经使用互联网URL对此进行了测试,这可行(此处代码略有变化)。我尝试使用htm调用Safari本地访问但没有快乐。 canOpenURL返回true Resp var)但是openURL返回false(Resp2)。 如果有其他方法可以做到这一点,或者对swift和iOS模拟器有一些限制,我不会修复此代码吗?
var txtPath = NSString(string:NSBundle.mainBundle().pathForResource("ReadMe", ofType: "htm")!)
let targetURL=NSURL(fileURLWithPath: txtPath)
let application=UIApplication.sharedApplication()
var Resp=application.canOpenURL(targetURL!)
var Resp2=application.openURL(targetURL!);
答案 0 :(得分:0)
我正在尝试调用外部应用程序
在iOS上,将文档交给另一个应用程序的方法是使用UIDocumentInteractionController并让用户选择一个应用程序。例如,如果您从Numbers文档开始,则用户将能够从UIDocumentInteractionController中选择Numbers(如果它存在于设备上)。