Apple 拒绝了我的应用程序,因为它不包含允许用户从文件应用程序查看或 select 项目的功能
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 拒绝了应用程序,并要求将功能添加到文件应用程序中的 select 视频项目。
这是 Apple 给我的原因:
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.
他们似乎希望您使用 UIDocumentPickerViewController
使用户能够根据条款 2.5.15
从云服务和照片库中 select 视频文件
Apple 希望他们的客户在使用他们的设备及其 运行 上的应用程序时获得良好的体验,因此您的应用程序支持所有相关 iOS 功能是有意义的。
您可以使用以下方法为 select 个视频文件创建显示文档选择器:
let picker = UIDocumentPickerViewController(documentTypes: ["public.movie"], in: .import)
picker.delegate = self
self.show(picker, sender: self)
您将需要执行一些委托代码来处理选取的文档。例如,要将 selected 文件复制到应用程序的文档目录中:
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 Apps that enable users to view and select files should include items from the Files app and the user’s iCloud documents.
看起来你应该像@Paulw11 指出的那样添加 UIDocumentPickerViewController
支持
在我的应用程序中,我使用以下方法从图库中获取视频:
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
}
但 Apple 拒绝了应用程序,并要求将功能添加到文件应用程序中的 select 视频项目。
这是 Apple 给我的原因:
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.
他们似乎希望您使用 UIDocumentPickerViewController
使用户能够根据条款 2.5.15
Apple 希望他们的客户在使用他们的设备及其 运行 上的应用程序时获得良好的体验,因此您的应用程序支持所有相关 iOS 功能是有意义的。
您可以使用以下方法为 select 个视频文件创建显示文档选择器:
let picker = UIDocumentPickerViewController(documentTypes: ["public.movie"], in: .import)
picker.delegate = self
self.show(picker, sender: self)
您将需要执行一些委托代码来处理选取的文档。例如,要将 selected 文件复制到应用程序的文档目录中:
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 Apps that enable users to view and select files should include items from the Files app and the user’s iCloud documents.
看起来你应该像@Paulw11 指出的那样添加 UIDocumentPickerViewController
支持