Your application receives push notifications through multiple paths, depending on the state of your app when it is received.
If your app is not launched (not even suspended in background), the launchOptions
will contain the notification payload (key UIApplicationLaunchOptionsRemoteNotificationKey
).
If it is already running or suspended in background, the app will receive the notifications via application:didReceiveRemoteNotification:
in your application delegate.
The process is the same for local notifications (UIApplicationLaunchOptionsLocalNotificationKey in application:didFinishLaunchingWithOptions: and application:didReceiveLocalNotification:
)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…