Unity.Platform.IPhone.IPhoneNotification.CancelLocalNotification C# (CSharp) Method

CancelLocalNotification() public method

public CancelLocalNotification ( System.DateTime fireDate ) : void
fireDate System.DateTime
return void
		public override void CancelLocalNotification (DateTime fireDate)
		{
			UIApplication.SharedApplication.InvokeOnMainThread (delegate { 
				int numScheduledLocalNotifications = this.GetCurrentScheduledLocalNotifications();
				if(numScheduledLocalNotifications<=0) {
					SystemLogger.Log(SystemLogger.Module.PLATFORM,"No scheduled local notifications found. It is not possible to cancel the one requested");
				} else {
					SystemLogger.Log(SystemLogger.Module.PLATFORM, "(1) Current scheduled #num of local notifications: " + numScheduledLocalNotifications);
					NSDate fireDateNS = IPhoneUtils.DateTimeToNSDate(DateTime.SpecifyKind(fireDate, DateTimeKind.Local));
					SystemLogger.Log(SystemLogger.Module.PLATFORM, "Checking local notification to be cancelled, scheduled at " + fireDateNS.ToString());
					foreach(UILocalNotification notification in UIApplication.SharedApplication.ScheduledLocalNotifications) {
						if(notification.FireDate.SecondsSinceReferenceDate == fireDateNS.SecondsSinceReferenceDate) {
							SystemLogger.Log(SystemLogger.Module.PLATFORM, "Cancelling notification scheduled at: " + notification.FireDate.ToString());
							UIApplication.SharedApplication.CancelLocalNotification(notification);
							SystemLogger.Log(SystemLogger.Module.PLATFORM, "Cancelled");
						}
					}
					SystemLogger.Log(SystemLogger.Module.PLATFORM, "(2) Current scheduled #num of local notifications: " + this.GetCurrentScheduledLocalNotifications());
				}
			});

		}