更新时间:2022-11-28 12:04:33
这是我用来处理附件部分的代码;更改在AppDelegate.swift文件中
Here is the code that I use to deal with the attachment part; the change is in the AppDelegate.swift file
func application(application: UIApplication, openURL url: NSURL, sourceApplication: String?, annotation: AnyObject) -> Bool {
//url contains a URL to the file your app shall open
do {
if (url.path!.hasSuffix("fileext1")){
let storyboard = UIStoryboard(name: "Main", bundle: nil)
let vc = storyboard.instantiateViewControllerWithIdentifier("AddComment") as! AddCommentViewController
vc.imported = true
window?.rootViewController = vc
}
else if (url.path!.hasSuffix("fileext2")){
let result = try General.SaveXmlToCoreData(url.path!)
}
}
catch let error as NSError {
NSLog(error.localizedDescription)
}
return true
}