While working on your app’s notification permission flow it’s helpful to be able to test it as a new user launching your app for the first time.
This is how you can reset the permissions back to UNAuthorizationStatus.notDetermined
(opens in new tab):
- Stop your app in Xcode if it’s running:
⌘
.
or Product > Stop - Remove your app from
DerivedData
:open ~/Library/Developer/Xcode/DerivedData
and delete your app’s folder(s) - Quit System Preferences if opened:
⌘
Q
,killall System\ Preferences
, or stop theSystem Preferences
process in Activity Monitor - Restart Notification Center:
killall NotificationCenter
or stop theNotification Centre
process in Activity Monitor
Done! You can now run your app again and test the flow as a new user. No need to restart your computer.
Bonus
If you have to do this a lot, here’s a one-liner to remove your app from DerivedData
and restart Notification Center:
cd ~/Library/Developer/Xcode/DerivedData && rm -rf {YourProject}-??* && killall NotificationCenter
Remember to replace {YourProject}
with your app’s project name.