시간 기반 알림 응용 프로그램에서 작업 중입니다. 사용자는 자신의 미리 알림과 미리 알림 시간을 입력합니다. 문제는 현재 시간을 사용자 정의 시간과 지속적으로 비교하는 방법입니다. 모든 샘플 코드가 크게 도움이 될 것입니다. 왜냐하면 나는이 시점에 붙어 있기 때문이다.iPhone에서 시간 기반 알림 응용 프로그램 만들기
0
A
답변
15
현재 시간과 사용자 정의 시간을 비교하는 것은 올바른 디자인 패턴이 아닙니다.
UIKit은 작업에 대한 더 높은 수준의 추상화 인 NSLocalNotification 객체를 제공합니다. 다음은
만들고은 선택된 시간에 로컬 알림을 예약 코드 싹둑입니다 : 또한UILocalNotification *aNotification = [[UILocalNotification alloc] init];
aNotification.fireDate = [NSDate date];
aNotification.timeZone = [NSTimeZone defaultTimeZone];
aNotification.alertBody = @"Notification triggered";
aNotification.alertAction = @"Details";
/* if you wish to pass additional parameters and arguments, you can fill an info dictionary and set it as userInfo property */
//NSDictionary *infoDict = //fill it with a reference to an istance of NSDictionary;
//aNotification.userInfo = infoDict;
[[UIApplication sharedApplication] scheduleLocalNotification:aNotification];
[aNotification release];
, AppDelegate에 시작시 정상 동안 두 지역의 통지에 응답하기 위해 설치해야 응용 프로그램의 런타임 (당신도 응용 프로그램을 통지 할 경우는 전경에) 다음 Apple Developer Documentation에서
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
UILocalNotification *aNotification = [launchOptions objectForKey: UIApplicationLaunchOptionsLocalNotificationKey];
if (aNotification) {
//if we're here, than we have a local notification. Add the code to display it to the user
}
//...
//your applicationDidFinishLaunchingWithOptions code goes here
//...
[self.window makeKeyAndVisible];
return YES;
}
- (void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification {
//if we're here, than we have a local notification. Add the code to display it to the user
}
자세한 내용.
2
캘린더 일정과 매우 흡사하게 지정된 시간 동안 설정할 수 있습니다. 또는 EKEventKit
튜토리얼 local notifications과 함께 사용자 캘린더에 캘린더 이벤트를 추가 할 수 있습니다.
event kit에 대한 자습서.
관련 문제
- 1. iPhone에서 스트리밍 응용 프로그램 만들기
- 2. 웹 응용 프로그램에서 시간 기반 트리거 만들기
- 3. iPhone에서 웹 응용 프로그램 프로파일 만들기
- 4. C# WinForms : 백그라운드 알림 응용 프로그램 만들기
- 5. 응용 프로그램 이름없이 로컬 알림 만들기
- 6. 응용 프로그램 아이콘에 대한 알림 만들기
- 7. IPhone지도 응용 프로그램 만들기
- 8. ASP.NET 응용 프로그램 - 시간 예측 만들기
- 9. iPhone에서 응용 프로그램 평점
- 10. iPhone에서 다국어 응용 프로그램
- 11. Android 알림 응용 프로그램
- 12. PHP 응용 프로그램 + Socket.IO를 통한 WebSocket 기반 알림
- 13. 코코아 문서 기반 응용 프로그램
- 14. 유틸리티 응용 프로그램 및보기 기반 응용 프로그램
- 15. DAG 기반 응용 프로그램
- 16. 심 기반 응용 프로그램
- 17. TabBar의 기반 응용 프로그램
- 18. 탭 기반 응용 프로그램
- 19. 인터넷 기반 응용 프로그램
- 20. 위치 기반 응용 프로그램
- 21. 프로덕션 웹 기반 응용 프로그램 모니터링
- 22. iPad/iPhone에서 말괄량이 유형 알림?
- 23. iPhone에서 메일 응용 프로그램 보내기
- 24. iPhone에서 + 응용 프로그램 충돌이 발생했습니다.
- 25. iphone에서 비디오를 다운로드 응용 프로그램
- 26. iPhone에서 통화 전달 응용 프로그램
- 27. iPhone에서 응용 프로그램 업그레이드 방법
- 28. iPhone에서 MFI 응용 프로그램 디버그
- 29. iphone에서 응용 프로그램 내부에서 현지화
- 30. iPhone에서 강제 종료 응용 프로그램
스레드에서 도움을받을 수 있습니다. http://stackoverflow.com/questions/949416/how-to-compare-two-dates-in-objective-c – Ali3n
나는이 방법을 지속적으로 실행하고 싶습니다. 메소드는 위치 관리자의 didupdatetolocation처럼 호출됩니다. –