iOS应用开发:附件管理与冲突处理
1. 附件列表功能实现
1.1 运行应用
运行应用后,文本会显示在集合视图下方。
1.2 添加附件存储支持
要在iOS的Document类中添加存储附件的支持,可按以下步骤操作:
1. 打开 Document.swift 文件。
2. 添加 attachmentsDirectoryWrapper 属性,代码如下:
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...
超级会员免费看
订阅专栏 解锁全文
18

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



