Develop
2018.10.19 15:59
[ios] APNS, Remote Push 수신 시점에서 앱의 3가지 실행 상태
조회 수 976 댓글 0
iOS 앱에서 push를 수신할 때, 앱의 상태는 다음의 세 가지 상태 중 하나에 있다.
1. 앱이 실행 상태가 아님( push 수신으로 실행됨 )
2. 앱이 foreground( 실행 중 ) 상태에서 push를 수신함
3. 앱이 background 상태에서 push를 수신함
각각의 상태에서 별도의 다른 동작을 위해 이 상태를 구분할 수 있어야 하고, AppDelegate 내에서 다음의 코드를 통해 구분이 가능하다.
# Objective-C
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { if (launchOptions && [launchOptions objectForKey:UIApplicationLaunchOptionsRemoteNotificationKey]) { // 1번 상태에서 push 수신 } return YES; } - (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo { if (application.applicationState == UIApplicationStateActive) { // 2번 상태에서 push 수신 } else { // 3번 상태에서 push 수신 } }
-
[c] 도메인(호스트)으로 IP정보 알아오기.. (nslookup과 비슷)
-
[c] 숫자 맞추는 게임..
-
[c] 단기과정[01/06] sizeof, 실수표현, 메모리, 연산자
-
[php] 빔 프로젝터 예약 프로그램.. ㅋㅋ
-
[c] 소켓의 세가지 동작모드
-
[c] 프로세스 정보 출력하기..
-
[c] 맵서치인 듯(옛날 컴에서 찾은 자료)
-
[c] 단기과정[01/10] 과제.. swap(any data, ..)
-
[c] pcapdump 파일 분석 하는 프로그램.. ㅋㅋ
-
[c] 프로세스간의 통신(파이프)
-
[c] 간단한 순위 루틴.. (정보처리기사)
-
[c] 라인수 입력받아 마름모꼴 출력하기..