次のように、指定された日付のローカル通知を作成しています
UILocalNotification *localNotify = [[UILocalNotification alloc]init];
[localNotify setFireDate:notificationDate];
[localNotify setTimeZone:[NSTimeZone localTimeZone]];
[localNotify setAlertBody:@"Daily Items Reminder"];
//[localNotify setAlertLaunchImage:@"blank_Btn"];
[localNotify setAlertAction:@"View"];
[localNotify setSoundName:UILocalNotificationDefaultSoundName];
[localNotify setApplicationIconBadgeNumber:1];
[localNotify setRepeatInterval:NSDayCalendarUnit];
NSDictionary *userDict = [NSDictionary dictionaryWithObject:@"dict"
forKey:@"key"];
localNotify.userInfo = userDict;
[[UIApplication sharedApplication] scheduleLocalNotification:localNotify];
[localNotify release];
私のApplicationDidFinishLaunchingでは、次のようにUILocalNotificationのオブジェクトを作成します
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleBlackTranslucent];
UILocalNotification *notification = [launchOptions objectForKey:UIApplicationLaunchOptionsLocalNotificationKey];
if (notification)
{
NSInteger badgeNumber = notification.applicationIconBadgeNumber;
if (badgeNumber < 0)
{
notification.applicationIconBadgeNumber = 0;
}
else
{
notification.applicationIconBadgeNumber = badgeNumber - 1;
}
[self showAlertMessage:@"didFinishLaunchingWithOptions" withButtons:eOk forDelegate:self];
// open screen
}
}
Local Notificationが表示されたときに View ボタンをクリックすると、アプリケーションが起動し、launchOptionはキーを介してlocalnotification オブジェクトを返す必要がありますが、alertview が呼び出されないため、常に nil を返します??..何が間違っているのでしょうか??