Mobile/iOS
[iOS][Objective-C] Local Push
out of coding
2017. 1. 5. 10:29
알림을 앱에서 등록할 수 있는 기능이 있죠.
로컬 푸시. 등록할수 있는 갯수의 제한이 있기는 하지만.
유용하게 사용할수 있습니다. 64개까지 등록 가능.
NSDictionary *alertData = [userInfo objectForKey:@"alert"];
UILocalNotification *noti = [[UILocalNotification alloc]init];
noti.fireDate = [NSDate dateWithTimeIntervalSinceNow:10];
noti.timeZone = [NSTimeZone systemTimeZone];
noti.alertBody = [alertData objectForKey:@"body"];
noti.category = @"category1";
noti.applicationIconBadgeNumber = [[alertData objectForKey:@"badge"] integerValue];
noti.soundName = UILocalNotificationDefaultSoundName;
noti.userInfo = userInfo;
[[UIApplication sharedApplication] scheduleLocalNotification:noti];
10초뒤에 알림이 발생하도록 한것입니다.
주의할 점은 말씀드린것처럼.
1. 갯수의 제한이 있다.
2. 백그라운드에서는 등록이 안된다.
그럼 수고하세요.