Last Updated: February 25, 2016
·
1.318K
· novalagung

iOS - Simple local notification Example

UILocalNotification *notification = [[UILocalNotification alloc] init];
if (notification) {
    notification.fireDate = [NSDate date];
    notification.timeZone = [NSTimeZone defaultTimeZone];
    notification.repeatInterval = 0;
    notification.soundName = UILocalNotificationDefaultSoundName;
    notification.alertBody = @"Notification Message";
    notification.applicationIconBadgeNumber = [UIApplication sharedApplication].applicationIconBadgeNumber + 1;
    notification.userInfo = @{@"data" : @1};

    [[UIApplication sharedApplication] presentLocalNotificationNow:notification];
}