로컬 알림 기능
일부 게임 개발사는 로컬 알림 기능을 직접 구현하지 않았으므로, 이 기능 관련 인터페이스를 호출할 수 있습니다.
1. 로컬 알림 추가
함수
objective-c
- (void)gamedreamerAddLocalNotificationWithNotificationObject:(GamedreamerLocalNotification *)notificationObject AndCompletion:(void (^)(NSDictionary *result, NSError *error))completion;매개변수
GamedreamerLocalNotification
| 속성명 | 속성 타입 | 필수 여부 | 상세 설명 |
|---|---|---|---|
| notiID | NSString | 예 | 로컬 알림에 대응하는 식별 ID입니다. 추가하는 알림의 notiID 가 동일하면 나중에 추가한 알림이 이전 알림을 덮어씁니다. 이 특성을 이용해 같은 유형 알림을 갱신할 수 있습니다. |
| title | NSString | 예 | 로컬 알림의 제목 |
| content | NSString | 예 | 로컬 알림의 내용 |
| isRepeat | BOOL | 예 | 해당 알림이 고정 주기로 반복 발송되는 알림인지 여부 |
| repeatType | RepeatType | 아니오 | 주기성 알림의 반복 유형입니다. 현재 세 가지 유형을 지원합니다: RepeatDaily 매일 X시 X분에 알림, RepeatWeekly 매주 X요일 X시 X분에 알림, RepeatMonthly 매월 X일 X시 X분에 알림 |
| targetTimestamp | NSString | 예 | 알림 발송 시간 |
예제 코드
objective-c
#import <Gamedreamer/GamedreamerManager.h>
GamedreamerLocalNotification *notification = [[GamedreamerLocalNotification alloc] init];
NSDate *current = NSDate.date;
notification.notiID = @"123";
notification.title = @"test title";
notification.content = @"test content";
notification.isRepeat = true;
notification.repeatType = RepeatDaily;
notification.targetTimestamp = [NSString stringWithFormat:@"%f",[current timeIntervalSince1970]+20];
[GamedreamerManager.shareInstance gamedreamerAddLocalNotificationWithNotificationObject:notification AndCompletion:^(NSDictionary *result, NSError *error) {
NSLog(@"--------%@\n%@--------",result, error);
}];2. 추가된 로컬 알림 조회
함수
objective-c
- (void)gamedreamerGetLocalNotificationList:(void (^)(NSArray * notiList))completion;콜백
| 속성명 | 속성 타입 | 상세 설명 |
|---|---|---|
| notiID | NSString | 로컬 알림에 대응하는 식별 ID입니다. 추가하는 알림의 notiID 가 동일하면 나중에 추가한 알림이 이전 알림을 덮어씁니다. 이 특성을 이용해 같은 유형 알림을 갱신할 수 있습니다. |
| title | NSString | 로컬 알림의 제목 |
| content | NSString | 로컬 알림의 내용 |
| isRepeat | BOOL | 해당 알림이 고정 주기로 반복 발송되는 알림인지 여부 |
| repeatType | RepeatType | 주기성 알림의 반복 유형입니다. 현재 세 가지 유형을 지원합니다: RepeatDaily 매일 X시 X분에 알림, RepeatWeekly 매주 X요일 X시 X분에 알림, RepeatMonthly 매월 X일 X시 X분에 알림 |
| targetTimestamp | NSString | 알림 발송 시간 |
예제 코드
objective-c
[GamedreamerManager.shareInstance gamedreamerGetLocalNotificationList:^(NSArray *notiList) {
NSLog(@"--------%@--------",notiList);
for (GamedreamerLocalNotification *item in notiList) {
NSLog(@"--------%@--------",item.targetTimestamp);
}
}];3. 추가된 로컬 알림 제거
함수
objective-c
- (void)gamedreamerRemoveLocalNotificationWithNotiID:(NSString *)notiID;매개변수
| 매개변수명 | 매개변수 타입 | 매개변수 설명 |
|---|---|---|
| notiID | NSString | 삭제할 대상 알림의 식별 ID |
예제 코드
objective-c
[GamedreamerManager.shareInstance gamedreamerRemoveLocalNotificationWithNotiID:@"123"];