2016-08-02 1 views

답변

3

따라서 QuickTime Player 기록을 감지 할 수 없습니다.

하지만 약간의 트릭으로 해결책을 찾았습니다.

QuickTime Player 녹음이 실행 중이면 AVAudioSession의 출력 포트 유형이 HDMIOutput으로 변경되었습니다. 다음

그래서 (SWIFT 2.2) ...에있는 viewDidLoad 기능 AVAudioSessionRouteChangeNotification 통지를 첨가

func checkOutputPortType() { 
    let asRoute = AVAudioSession.sharedInstance().currentRoute 
    for output in asRoute.outputs { 
     if output.portType == AVAudioSessionPortHDMI { 
      // something you want.. 
     } 
    } 
} 

삽입 코딩.

NSNotificationCenter.defaultCenter().addObserver(self, selector: #selector(checkOutputPortType), name: AVAudioSessionRouteChangeNotification, object: nil) 

감사합니다. 당신이 AppDelegate.swift

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { 

    NotificationCenter.default.addObserver(self, selector: #selector(checkIFScreenIsCapture), name: NSNotification.Name.UIScreenCapturedDidChange, object: nil) ...... 

사용 선택에 통지

NSNotification.Name.UIScreenCapturedDidChange 

를 사용할 수있는 아이폰 OS (11)와 함께

0

func checkIFScreenIsCapture(notification:Notification){ 
    guard let screen = notification.object as? UIScreen else { return } 
    if screen.isCaptured == true { 

    }else{ 

    } 
} 
관련 문제