2017-10-03 3 views
2

다음 코드를 사용하여 화면을 녹화하고 있습니다. 그것은 ios10을 위해 잘 작동 ios9재생 키트가 작동하지 않음 IPAD IOS11 BUG

@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 완료 (폐쇄) 블록 호출하지 않음
조건인 경우 메서드가 올바르게 호출되는지 확인했습니다. 0 또한 당신과 같은 문제가 있었다 그것은

enter image description here

enter image description here

+0

하면 물리적 장치에 시도해 봤어 : RPPreviewViewControllerDelegate의

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) } } } } 

방법은? 아마도 [https://stackoverflow.com/questions/40024316](https://stackoverflow.com/questions/40024316/reading-from-public-effective-user-settings-in-ios-10) – mato

+0

@mato와 관련이 있습니다. 응답 주셔서 감사합니다 시뮬레이터에서 지원하지 않는 화면 녹화, 제공되는 링크는 문제와 관련이 없습니다 –

답변

2

에 대해 누군가가 알고 있다면 제발 도와주세요

에서 할 수 있습니다, 그래서 아이폰 OS 11.0.2로 업데이트에 thinked 그리고 그것은 나를 위해 일했습니다! 희망도 당신을 도울 수 있습니다.

이런 경우에, 여기 내 방법은 다음과 같습니다

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() 
     } 
    }