Develop
2018.10.19 15:59
[ios] APNS, Remote Push 수신 시점에서 앱의 3가지 실행 상태
조회 수 1078 댓글 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] RSA 암호화 구현(gmp 라이브러리 활용)
-
삼성페이(Samsung Pay) 구조
-
XE Core 1.8.18 본문 작성시 태그(html) 사라지는 버그
-
[js] AngularJS 란?
-
[mac] How to uninstall MySQL on Mac OS.
-
[virtualbox] VirtualBox에 Ubuntu 설치하기
-
[ios] 로컬에 있는 JS 파일 웹뷰에서 동적으로 실행하기
-
[ios] 오브젝티브C→스위프트, 코드 변환 손쉽게
-
[ios] Xcode에서 특정 파일만 ARC 따로 설정하는 방법
-
[android] 딜레이를 구현하기 위한 꼼수
-
[js] 스크롤 이벤트 막기
-
[ios] APNS, Remote Push 수신 시점에서 앱의 3가지 실행 상태