Apple 拒绝我的应用,因为不包含允许用户从"文件"应用中查看或选择项目的功能



在我的应用程序中,我使用以下方法从图库中获取视频:

- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
}

但是Apple被拒绝的应用程序,并且需要包含从"文件"应用程序中选择视频项目的功能。

这是苹果给我的理由:

我们注意到,你的应用允许用户查看和选择文件,但是 它不包括允许用户查看或选择 "文件"App 和用户的 iCloud 文稿中的项目(根据需要( 根据应用商店审核指南。

他们似乎希望您使用UIDocumentPickerViewController使用户能够根据第 2.5.15 条从云服务和照片库中选择视频文件

Apple 希望他们的客户能够使用他们的设备及其上运行的应用程序获得良好的体验,因此您的应用程序支持所有相关的 iOS 功能是有意义的。

您可以使用以下方法创建显示文档选取器以选择视频文件:

let picker = UIDocumentPickerViewController(documentTypes: ["public.movie"], in: .import)
picker.delegate = self
self.show(picker, sender: self)

您将需要实现一些委托代码来处理选取的文档。 例如,要将所选文件复制到应用的文档目录中,请执行以下操作:

extension ViewController: UIDocumentPickerDelegate {
func documentPicker(_ controller: UIDocumentPickerViewController, didPickDocumentsAt urls: [URL]) {
if let pickedUrl = urls.first {
let filename = pickedUrl.lastPathComponent
self.filename.text = filename
let paths = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask)
var documentsDirectory = paths[0]
// Apend filename (name+extension) to URL
documentsDirectory.appendPathComponent(filename)
do {
// If file with same name exists remove it (replace file with new one)
if FileManager.default.fileExists(atPath: documentsDirectory.path) {
try FileManager.default.removeItem(atPath: documentsDirectory.path)
}
// Move file from app_id-Inbox to tmp/filename
try FileManager.default.moveItem(atPath: pickedUrl.path, toPath: documentsDirectory.path)
UserDefaults.standard.set(filename, forKey:"filename")
UserDefaults.standard.set(documentsDirectory, forKey:"fileurl")
self.fileURL = documentsDirectory
} catch {
print(error.localizedDescription)
}
}
}
}

我可以在评论指南中看到该条款

2.5.15 允许用户查看和选择文件的 App 应包含"文件"App 中的项目和用户的 iCloud 文稿。

看起来你应该添加UIDocumentPickerViewController支持,正如@Paulw11指出的那样

最新更新