ios notification

Apple's notifications are divided into local notifications and remote notifications

  • If the user starts directly, there is no data in launchOptions;
  • If it is launched by other applications through openURL:, the object corresponding to UIApplicationLaunchOptionsURLKey is the launch URL (NSURL), and UIApplicationLaunchOptionsSourceApplicationKey corresponds to the bundle ID (NSString) of the source application launched;
  • If it is started by local notification, UIApplicationLaunchOptionsLocalNotificationKey corresponds to the local notification object ( UILocalNotification ) for starting the application ;
  • If it is started by remote notification, UIApplicationLaunchOptionsRemoteNotificationKey corresponds to the remote notification information userInfo (NSDictionary) of the starting application;
  • Other keys are UIApplicationLaunchOptionsAnnotationKey, UIApplicationLaunchOptionsLocationKey,
    UIApplicationLaunchOptionsNewsstandDownloadsKey.

No sound for local notifications when app is in foreground

 

  • 
    - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
    {
        NSURL *url = [options objectForKey:UIApplicationLaunchOptionsURLKey];
        if(url)
        {
        }
        NSString *bundleId = [options objectForKey:UIApplicationLaunchOptionsSourceApplicationKey];
        if(bundleId)
        {
        }
        UILocalNotification * localNotify = [options objectForKey:UIApplicationLaunchOptionsLocalNotificationKey];
        if(localNotify)
        {
        }
        NSDictionary * userInfo = [options objectForKey:UIApplicationLaunchOptionsRemoteNotificationKey];
        if(userInfo)
        {
        }
    
    }

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326688160&siteId=291194637