# iOS Local Notifications not working until after App restart

**URL:** <https://forum.ionicframework.com/t/ios-local-notifications-not-working-until-after-app-restart/222288>\
**Category:** Capacitor\
**Created:** [April 11, 2022, 9:48pm UTC](https://forum.ionicframework.com/t/ios-local-notifications-not-working-until-after-app-restart/222288 "2022-04-11T21:48:00Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![fearnycompknowhow](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/fearnycompknowhow/32/136901_2.png) [@fearnycompknowhow](https://forum.ionicframework.com/u/fearnycompknowhow)\
**Post date:** [April 11, 2022, 9:48pm UTC](https://forum.ionicframework.com/t/ios-local-notifications-not-working-until-after-app-restart/222288/1 "2022-04-11T21:48:00Z")

</div>

My stack is Ionic + Vue (v. 5.4.0) and Capacitor (v. 2.4.7). I’m having trouble getting the Local Notifications to trigger properly.

Here’s a slightly simplified version of my code:

```auto
await LocalNotifications.requestPermission();
await LocalNotifications.schedule({
	notifications: [{
		title: 'TESTING',
		body: 'TEST',
		id: 1,
		schedule: {
			at: new Date(Date.now() + 2000), // Schedule this for 2 seconds from now
			repeats: false
		},
		autoCancel: true
	}]
});

```

You’ll notice that I’m requesting permission to show Local Notifications just prior to showing one. The problem is it seems that I am unable to schedule notifications **during the session in which I authorizer permission for the notifications**.

However, **if I close the app and open it again** , the notifications work just fine.

To add to the confusion: if I schedule a notification for the current time instead of some time in the future, it will show a notification (but **only** that particular notification) as soon as I press the “Allow” button on the permission request modal:

```auto
await LocalNotifications.requestPermission();
await LocalNotifications.schedule({
	notifications: [{
		title: 'TESTING',
		body: 'TEST',
		id: 1,
		schedule: {
			at: new Date(), // Notice that I'm not modifying this date
			repeats: false
		},
		autoCancel: true
	}]
});

```

Although, as a side note I do see an error in the console that indicates that messages should be scheduled in the future:

> ERROR MESSAGE: {“message”:“Scheduled time must be _after_ current time”,“errorMessage”:“”}

I’ve tested this on XCode emulator using both iOS version 12.x and iOS version 15.x
