快速从电子邮件发送plist附件(NS可可错误域代码260) [英] plist attachment from email in swift (NS Cocoa Error Domain Code 260)

查看:45
本文介绍了快速从电子邮件发送plist附件(NS可可错误域代码260)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在通过plist中包含的电子邮件发送一些ios文件数据.附加它没有问题,我可以检查文件和内容.一切都在那里,我可以将其作为plist打开.单击它(我已将其与我的应用程序关联),它将打开并获得有效路径:

I am sending some ios file data via an email contained in a plist. No issues attaching it, I can check the file and the contents. It's all there and I can open it as a plist. Clicking on it (I have associated it with my app) it opens and I get a valid path:

file:///private/var/mobile/Containers/Data/Application/C5454580-2BEB-4515-9BDE-FED85FF54F76/Documents/Inbox/ShareStrength-11.bps

我通过的

,但是当我尝试读回 NSDictionary (plist)时,我得到的内容是 nil .

that I pass but when I try and read back the NSDictionary (plist) I get nil content.

let sourceFile = NSDictionary(contentsOfFile: URLString)

关于出了什么问题的任何想法.调试困难.

Any ideas on what is going wrong. Having difficulty debugging.

我发现了一些错误代码:

I found some error code:

var error: NSError?
let content = NSString(contentsOfFile: URLString, encoding:NSUTF8StringEncoding, error: &error)
if content != nil
{
    println("content: \(content)")
}
else
{
    println("error: \(error)")
}

我得到了错误:

error: Optional(Error Domain=NSCocoaErrorDomain Code=260 "The operation couldn’t be completed. (Cocoa error 260.)" UserInfo=0x17eceeb0 {NSFilePath=file:///private/var/mobile/Containers/Data/Application/571DB0FF-6C5A-4BEB-9FA8-6E4DFE10E850/Documents/Inbox/ShareStrength-13.bps, NSUnderlyingError=0x17ee9810 "The operation couldn’t be completed. No such file or directory"})

这是沙盒问题吗?如何复制作为 URL 传递的附件?

Is this a sandbox issue? How can I copy the attachment being passed as a URL?

推荐答案

我正在使用:

let URLString: String = url.absoluteString!

代替:

let URLString: String = url.path!

希望这对其他人有帮助

这篇关于快速从电子邮件发送plist附件(NS可可错误域代码260)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆