繁体   English   中英

苹果拒绝了我的应用程序,因为它不包含允许用户查看或选择“文件”应用程序中的项目的功能

[英]Apple reject my app because of not include functionality to allow users to view or select items from the Files app

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

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

但是Apple拒绝了该应用程序,并要求它包括从“文件”应用程序中选择视频项目的功能。

这是苹果给我的原因:

我们注意到,您的应用程序使用户能够查看和选择文件,但未包含根据App Store审查指南的要求,该功能允许用户查看或选择“文件”应用程序和用户的iCloud文档中的项目。

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

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

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

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

您将需要实现一些委托代码来处理选择的文档。 例如,要将所选文件复制到应用程序的documents目录中:

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使用户能够查看和选择文件的应用程序应包括“文件”应用程序中的项目以及用户的iCloud文档。

看起来您应该像@ Paulw11所指出的那样添加UIDocumentPickerViewController支持

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM