iOS应用中附件管理与冲突处理全解析
1. 附件列表的设置
在完成界面设置后,我们要为iOS的Document类添加存储附件的支持,具体操作步骤如下:
1. 打开 Document.swift 文件。
2. 添加 attachmentsDirectoryWrapper 属性,该属性返回一个 FileWrapper ,代表存储附件的文件夹。若文件夹不存在,则会创建它。代码如下:
fileprivate var attachmentsDirectoryWrapper : FileWrapper? {
// Ensure that we can actually work with this document
guard let fileWrappers = self.documentFileWrapper.fileWrappers else {
NSLog("Attempting to access document's contents, but none found!")
return nil
}
// Try to get the attachments directory
var attachmentsDirectoryWrapper =
fileWrappers[NoteDocumentFileNames.AttachmentsDirectory.rawValue]
// If it doesn't exist...
if
超级会员免费看
订阅专栏 解锁全文
8

被折叠的 条评论
为什么被折叠?



