IOS成长之路-推送(本地推送)

1、打开本地推送并设置属性

NSString *str = @"本地推送的信息";
    UIApplication *app = [UIApplication sharedApplication];
    UILocalNotification *notification = [[UILocalNotification alloc]init];//初始化本地推送
    notification.soundName = UILocalNotificationDefaultSoundName;//设置声音
    notification.alertBody = str;//设置推送的消息
    [app scheduleLocalNotification:notification];//实现本地推送的关键步骤,
    [notification release];
    [str release];
通过上面的方法可以实现推送的效果


2、本地推送的接受方法 

- (void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification


你可能感兴趣的:(IOS成长之路-推送(本地推送))