重放套件不工作IPAD IOS11 BUG
我正在使用下面的代码来logging屏幕。 它工作正常的ios10和ios9
@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") } }
我可以看到在ios10和ios9中提示权限,但不能为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() } }
- 毒蛇的第一个项目
- 如何在第一次推vc时popup提示模态vc 12次?
- iOS – 不覆盖自身的画笔
- xCode:如何修复线程5:EXC_BREAKPOINT(code = 1,subcode = 0x10025c76c)
- AGPushNote替代Swift?
- 以编程方式创build标签栏控制器后,如何添加导航界面(Swift)
- ALAsset valueForProperty:ALAssetPropertyLocation未声明?
- iOS:如何在一个iPad中像App一样开发iPad应用程序成为pipe理员和同一个App的其他iPad成为Listner
- 如何将一个背景图像添加到将滚动和缩放的单元格的UICollectionView