我正在嘗試在 iPhone 上的 Files 應用程式中顯示我的資料
func fileManger(nameFolder: String) {
let manager = FileManager.default
let DecomentFolder = manager.urls(for: .documentDirectory, in: .userDomainMask).last
let Folder = DecomentFolder?.appendingPathComponent("\(nameFolder)")
do {
try manager.createDirectory(at: Folder!, withIntermediateDirectories: true, attributes: [:])
} catch let error {
print(error.localizedDescription)
}
}
同樣在這里,我將值發送為檔案夾
@objc func alertNewFolder () {
let alert = UIAlertController(title: "Create an album", message: "", preferredStyle: .alert)
alert.addTextField(configurationHandler: nil)
alert.textFields![0].placeholder = "name album"
alert.textFields![0].textAlignment = .right
alert.addAction(UIAlertAction(title: "cancel", style: .cancel, handler: nil))
alert.addAction(UIAlertAction(title: "save", style: .default, handler: { ? in
if let textFileds = alert.textFields {
let links = textFileds[0].text
self.arrS1.append(addCatogrey(nameCatog: links!, imageSection: UIImage(named: "folder")))
// Here Send FileManager
helperCoding().fileManger(nameFolder: links!)
self.collection.reloadData()
}
}))
self.present(alert, animated: true, completion: nil)
}
在模擬器中,它正確保存在 Documents 檔案夾中
/Users/badrshammry/Library/Developer/CoreSimulator/Devices/7986A27F-7026-45E1-9073-78CCD6A9B90A/data/Containers/Data/Application/3173C4DC-BCDE-41B9-89E1-6E8D9B52EF25/Documents
uj5u.com熱心網友回復:
如果您想在 Apple 的 Files App 中公開您的 App 檔案檔案,您需要"Supports Document Browser"在 info plist 檔案中包含密鑰并將其設定為 YES:

轉載請註明出處,本文鏈接:https://www.uj5u.com/ruanti/405335.html
標籤:
上一篇:Vapor:發送post請求
