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

浪尽此生 提交于 2019-12-01 07:34:20

问题


In my app I am get video from gallery using below method:

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

But Apple is rejected app and required to include functionality to select video items from Files app.

Here is Apple give me the reason:

We noticed that your app enables users to view and select files, but it does not include functionality to allow users to view or select items from the Files app and the user's iCloud documents, as required by the App Store Review Guidelines.


回答1:


It seems that they want you to use UIDocumentPickerViewController to enable users to select video files from cloud services as well as from the photo library in accordance with clause 2.5.15

Apple wants their customers to have a good experience with their device and the apps they run on it, so it makes sense for your app to support all relevant iOS features.

You can create a show a document picker to select video files using:

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

You will need to implement some delegate code to handle the picked document. For example, to copy the selected file into your app's documents directory:

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:


I could see the clause in the review guideline

2.5.15 Apps that enable users to view and select files should include items from the Files app and the user’s iCloud documents.

Looks like you should add UIDocumentPickerViewController support as @Paulw11 pointed out



来源:https://stackoverflow.com/questions/51095560/apple-reject-my-app-because-of-not-include-functionality-to-allow-users-to-view

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!