0
我工作的一個應用程序擴展,我想允許用戶與主機應用程序共享各種文件。保存文件宿主應用程序
實施例:挑選照片,通過應用選擇份額,照片保存到共享文件夾&然後可用時用戶下次打開主機應用程序。
我的主機應用程序已準備好從共享文件夾中讀取數據,而擴展名僅用圖像設置,但我堅持的是檢索文件數據(blob或路徑我不確定?),然後將其寫入共享文件夾。
下面是擴展的相關章節:
override func didSelectPost() {
let content = extensionContext!.inputItems[0] as NSExtensionItem
for attachment in content.attachments as [NSItemProvider] {
// Image attachment
if attachment.hasItemConformingToTypeIdentifier(kUTTypeImage as String) {
// save this to file in shared folder for host app to retrieve...
}
}
self.extensionContext!.completeRequestReturningItems([], completionHandler: nil)
}
我已經看了很多其他的問題,但似乎無法找到任何符合我的使用情況。
感謝。我確實已經整理了這部分內容,它是保存到組共享文件夾的代碼,我遇到了麻煩,儘管我已經回去並重新實現了與Obj C不同的方法。 – KenTenMen