将推送过来的远程推送信息转成本地推送

+ (void)startLocalNotification:(NSString *)msg
{    
    UILocalNotification *notification = [[UILocalNotification alloc] init];
    if (notification!=nil)
 {
        NSDate *now=[NSDate new];
        notification.fireDate=[now dateByAddingTimeInterval:1]; //触发通知的时间
        notification.repeatInterval=0; //循环次数,kCFCalendarUnitWeekday一周一次
        notification.timeZone=[NSTimeZone defaultTimeZone];
        notification.soundName = UILocalNotificationDefaultSoundName;
        notification.alertBody=msg;
        notification.alertAction = @"打开";  //提示框按钮
        notification.hasAction = YES; //是否显示额外的按钮,为no时alertAction消失
        notification.applicationIconBadgeNumber = 0; //设置app图标右上角的数字
        [[UIApplication sharedApplication] scheduleLocalNotification:notification];
  }
}

 

posted @ 2016-04-13 15:48  懒懒初阳  阅读(252)  评论(0编辑  收藏  举报