Core data 如何在IOS应用程序中根据用户在附件上的文件扩展名打开特定视图(swift)
大家早上好,我需要你们的帮助(再次);我创建了一个应用程序,该应用程序生成具有两个不同文件扩展名的文件,如下所示:Core data 如何在IOS应用程序中根据用户在附件上的文件扩展名打开特定视图(swift),core-data,swift2,Core Data,Swift2,大家早上好,我需要你们的帮助(再次);我创建了一个应用程序,该应用程序生成具有两个不同文件扩展名的文件,如下所示: 第一个扩展名:.myexport(用于共享本地核心数据存储器中存储的所有信息) 第二个扩展名:.myshare(用于共享本地核心数据存储中的特定记录) 这里的主要思想是,如果用户希望与其他设备(例如朋友设备)共享该信息,则可以通过电子邮件发送文件,因此当其他用户收到带有附件的电子邮件时,应在查看a(基于下图)中打开,并在新设备中导入文件内容。但用户也可以将特定记录作为附件发送给另一
感谢您的帮助。您好,我根据一篇与推送通知相关的帖子找到了答案 下面是我用来处理附件部分的代码;更改位于AppDelegate.swift文件中
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
}
嗨,我是根据一篇与推送通知相关的帖子想出来的 下面是我用来处理附件部分的代码;更改位于AppDelegate.swift文件中
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
}