我正在努力处理几行令人尴尬的代码。我已经阅读了很多答案,但似乎都没有用。在我的函数中,我从所选文档中获取文件路径:funcdocumentPicker(_controller:UIDocumentPickerViewController,didPickDocumentAturl:URL){leturlString=url.pathletfileName=url.lastPathComponentletref=DataService.instance.imagesStorageRef.child("\(fileName)")varcontents=try?Data(contentsOf: