What's Wrong with my notification code?

给你一囗甜甜゛ 提交于 2019-12-04 18:47:54

Something that stumped me: you won't see the notification while the app is in the foreground. You need to hit the home button on the simulator to put the app into the background or else, to see something while the app is active, implement the app delegate protocol method: - (void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification in your app and make that method display something.

It works for me when i copy this code, except i don't set your sound and you have not shown how you set 'hour' so i hard coded it. Here is the output.

2013-01-09 17:57:17.968 TestStackOverflow[3322:11303] fireDate = 0001-01-01 06:17:32 +0000 2013-01-09 17:57:17.993 TestStackOverflow[3322:11303] +++scheduledLocalNotifications ( "{fire date = Monday, January 1, 1, 1:00:00 AM GMT-05:17:32, time zone = America/Toronto (EST) offset -18000, repeat interval = NSHourCalendarUnit, repeat count = UILocalNotificationInfiniteRepeatCount, next fire date = Wednesday, January 9, 2013, 6:17:32 PM Eastern Standard Time, user info = {\n information = \"Some information\";\n}}"

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!