重放套件不工作IPAD IOS11 BUG

我正在使用下面的代码来logging屏幕。 它工作正常的ios10ios9

@IBAction func btnRecordTapped(_ sender: UIButton) { if RPScreenRecorder.shared().isAvailable { if #available(iOS 10.0, *) { RPScreenRecorder.shared().startRecording(handler: { (error) in guard error == nil else { print("Record failed with error \(error!.localizedDescription)") return } DispatchQueue.main.async { sender.removeTarget(self, action: #selector(self.btnRecordTapped(_:)), for: .touchUpInside) sender.addTarget(self, action: #selector(self.stoprecording(button:)), for: .touchUpInside) sender.setTitle("Stop", for: .normal) sender.setTitleColor(.red, for: .normal) } }) } else { RPScreenRecorder.shared().startRecording(withMicrophoneEnabled: false, handler: { (error) in guard error == nil else { print("Record failed with error \(error!.localizedDescription)") return } DispatchQueue.main.async { sender.removeTarget(self, action: #selector(self.btnRecordTapped(_:)), for: .touchUpInside) sender.addTarget(self, action: #selector(self.stoprecording(button:)), for: .touchUpInside) sender.setTitle("Stop", for: .normal) sender.setTitleColor(.red, for: .normal) } }) } } else { print("Screen Reocrder not availble") } } 

我可以看到在ios10ios9中提示权限,但不能为ios11

ios11完成(closures)块永远不会调用
我已经validation方法调用正确,如果条件if RPScreenRecorder.shared().isAvailable {也允许让

请帮助我,如果有人知道这件事

在这里输入图像说明

在这里输入图像说明

我有和你一样的问题,所以我想在更新到iOS 11.0.2,它为我工作! 希望它也能帮助你。

以防万一,这里是我的方法:

 let recorder = RPScreenRecorder.shared() @IBAction func recordingAction(_ sender: Any) { if recorder.isRecording { stopRecordAction() } else { startRecordAction() } } func startRecordAction() { recorder.startRecording{ (error) in if let error = error { print("❗️",error) } } } func stopRecordAction() { recorder.stopRecording{ (previewVC, error) in if let previewVC = previewVC { previewVC.previewControllerDelegate = self self.present(previewVC, animated: true, completion: nil) if let error = error { print("❗️",error) } } } } 

RPPreviewViewControllerDelegate方法:

 func previewControllerDidFinish(_ previewController: RPPreviewViewController) { dismiss(animated: true, completion: nil) } func previewController(_ previewController: RPPreviewViewController, didFinishWithActivityTypes activityTypes: Set<String>) { /// This path was obtained by printing the actiong captured in "activityTypes" if activityTypes.contains("com.apple.UIKit.activity.SaveToCameraRoll") { recordFinshedMessage() } }