스크린 캡쳐 또는 녹화가 시작되면 Notification 호출
: 캡쳐나 녹화 한다는건 알 수 있지만 실제 스크린샷을 막지는 못한다. 스크린샷이 찍힌 후에 호출되는거 같다.
NotificationCenter.default.addObserver(
self,
selector: #selector(screenshotCapture),
name: UIApplication.userDidTakeScreenshotNotification,
object: nil
)
NotificationCenter.default.addObserver(
self,
selector: #selector(screenRecoding),
name: UIScreen.capturedDidChangeNotification,
object: nil
)
@objc func screenshotCapture() {
// 스크린샷 캡쳐 노티 함수
}
@objc func screenRecoding() {
// 스크린샷 시작 및 종료시 둘다 호출되므로 isCaptured로 녹화 종료시에는 리턴
guard UIScreen.main.isCaptured else {
return
}
// 스크린 녹화 노티 함수
}
'Swift > 기타' 카테고리의 다른 글
[SWIFT]키체인 사용 KeyChainWrapper (0) | 2023.05.08 |
---|---|
[SWIFT]XCode 14.3 Archive시 PhaseScriptExecution 오류 (0) | 2023.04.27 |
[SWIFT]Contraints 코드로 활성화 비활성화 제어하기 (0) | 2023.04.24 |
[SWIFT]NotificationCenter 사용 (0) | 2023.04.24 |
[SWIFT] GPS 현재 위치 정보(위도,경도) 및 상세주소 가져오기 (0) | 2023.04.24 |