cocos2dx 加本地推送通知

SystemHelper::createLocalNotification(someTask.seconds, SystemHelper::getLocalizedText("Task_Finish"));

void SystemHelper::createLocalNotification(unsigned long time,const char *msg)

{

    UILocalNotification* notif = [[UILocalNotification alloc] init];

    if(nil != notif){

        NSDate* now = [NSDate new] ;

        notif.fireDate= [now dateByAddingTimeInterval:time];

        notif.repeatInterval=0;

        notif.timeZone=[NSTimeZone defaultTimeZone];

        notif.applicationIconBadgeNumber = [[UIApplication sharedApplication] applicationIconBadgeNumber] + 1;

        notif.soundName= UILocalNotificationDefaultSoundName;

        notif.alertBody= [NSString stringWithUTF8String:msg];

//        notif.hasAction = NO;

        [[UIApplication sharedApplication] scheduleLocalNotification:notif];

    }

}

posted @ 2015-04-14 12:37  Mareon  阅读(201)  评论(0编辑  收藏  举报