문제

I have gone through many questions, but didn't get exactly how I'll get the lock/unlock event for iOS 5 and above.

From the various post, I understood that when user locks the screen in iOS 5 iPhone, socket connection is lost and for that we need to handle network connectivity part in background method beginBackgroundTaskWithExpirationHandler.

But is there an exact way to handle specifically lock/unlock event on iOS? Because applicationWillResignActive method is called for screen locking/unlocking and other events, like exiting application by pressing home button or launching another application.

Is there any specific delegate method called only when iPhone screen is locked/unlocked?

도움이 되었습니까?

해결책

No, there's no way of distinguishing in general why your app transitions to the background. There are some ways to detect, say, a phone call (CTCallCenter in the Core Telephony framework), but there's no way to tell that the device is locked specifically.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top