2011-12-08 10 views
0

iPhoneのプログラミングには初めてです。私は私のアプリケーションでlocalNotificationを使用しています。ユーザーに警告を出し、didReceiveLocalNotification.Butを使って起動するように応答しています。私のアプリケーションでUILocalNotificationを閉じると問題が発生します。データベース操作を実行する必要があります。それに対するアプローチ。iPhone SDKでユーザーがUILocaNotification警告をキャンセルした場合にメソッドを実行

UILocalNotification *localNotification = [[UILocalNotification alloc] init]; 
    NSDate* now = [NSDate date]; 
    [localNotification setFireDate:now]; 
    [email protected]"Tink.wav"; 

    [localNotification setAlertAction:@"Launch"]; 
    [localNotification setAlertBody:@"You have entered to Your Place:"]; 
    [localNotification setHasAction: YES]; 
    NSDictionary *userDict = [NSDictionary dictionaryWithObject:@"obj" forKey:kRemindMeNotificationDataKey]; 
    localNotification.userInfo = userDict; 



- (void)application:(UIApplication *)app didReceiveLocalNotification:(UILocalNotification *)notif { 
    NSLog(@"Recieved Notification"); 

    NSString *DateString=[notif.userInfo valueForKey:kRemindMeNotificationDataKey]; 
    if([DateString isEqualToString:@"obj"]) 
    { 
     [[UIApplication sharedApplication] cancelLocalNotification:notif]; 
    } 

    NSString *strNotif=[notif.userInfo objectForKey:kRemindMeNotificationDataKey]; 
if ([strNotif isEqualToString:@"obj"]) { 
    UIAlertView *alretCheck=[[UIAlertView alloc]initWithTitle:@"notifi Testing in DidRec+" message:strNotif delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil]; 
    [alretCheck show]; 
    [alretCheck release]; 
} 

ありがとうございます。

答えて

3

Now Acc。私の知識には、あなたが望むことをすることはできません。私たちは、LocalNotification Alertの "View"オプションについてのみコマンドを持っています。しかし、可能な場合は、1つのことを行うことができますonClick "View"ボタンでuはActionSheetまたは別のアラートを表示することができ、それらのボタンであなたが望むすべてのイベントを処理することができます。

関連する問題