【问题标题】:LocalNotification On Click Not HandlerLocalNotification On Click Not Handler
【发布时间】:2013-05-28 07:47:55
【问题描述】:

您好,我正在使用LocalNotifications 开发一个应用程序。我想创建一个处理程序,当用户点击NotificationBar 中的通知时,它将向他显示从通知接收到的带有 Title 和 Descr 的新 Viewctontroler。

 UILocalNotification *notif;

      for(int i=0 ; i<[idnoty count]; i++){
       notif=[[UILocalNotification alloc]init];
           if (notif == nil) return;


     notif.fireDate = [NSDate date];// Now here you can manage the fire time.
     notif.timeZone = [NSTimeZone defaultTimeZone];
     [notif setHasAction:NO];
     notif.timeZone = [NSTimeZone localTimeZone];
     notif.alertBody = [titlenoty objectAtIndex:i];
      notif.alertAction=[descrnoty objectAtIndex:i];
      notif.applicationIconBadgeNumber = i+1;
      notif.soundName = UILocalNotificationDefaultSoundName;
  NSDictionary *infoDict = [NSDictionary dictionaryWithObjectsAndKeys:@"Object 2",@"Key 2", nil];
      notif.userInfo = infoDict;

               //apostolh gia na svisei ta push
   NSString *URLTest=[dict objectForKey:@"URL"];
   NSString *URL1=[NSString stringWithFormat:@"%@%@",URLTest,@"push.php?"];

   NSString *strURL1 = [NSString stringWithFormat:@"%@id=%@",URL1,[idnoty objectAtIndex:i]];


 NSData *dataURL1 = [NSData dataWithContentsOfURL:[NSURL URLWithString:strURL1]];

 [[UIApplication sharedApplication] scheduleLocalNotification:notif ];

 }

【问题讨论】:

    标签: iphone xcode localnotification


    【解决方案1】:

    您可以在

    中进行此处理
    - (void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification
    

    【讨论】:

    • 以及我如何知道录制了哪些通知。如果我有 n+1 个通知?
    • 这将与您在“通知中心栏/视图”中交互的通知一起调用
    • 这个方法会调用n+1次吗?
    • no.. 调用您的应用的通知只有一次。
    猜你喜欢
    • 2021-02-06
    • 2016-03-27
    • 1970-01-01
    • 1970-01-01
    • 2015-06-12
    • 2014-02-26
    • 1970-01-01
    • 1970-01-01
    • 2013-01-30
    相关资源
    最近更新 更多