sa44
1
Hi in the Push Notifications Tutorial: Getting Started I am getting the error “Cannot find ‘self’ in scope” under
func registerForPushNotifications()
https://www.raywenderlich.com/11395893-push-notifications-tutorial-getting-started
Any ideas how to clear error?
Thank you
syedfa
2
@sa44 Thanks very much for your question!
Is it possible for you to paste the full function to show what it is you are referring to?
sa44
3
Sure
func registerForPushNotifications() {
UNUserNotificationCenter.current()
.requestAuthorization(
options: [.alert, .sound, .badge]) { [weak self] granted, _ in
print(“Permission granted: (granted)”)
guard granted else { return }
self?.getNotificationSettings()
}
}
sa44
4
So sorry. It was my fault. I put the function outside of the AppDelegate class. opps!. Thanks for your time
system
Closed
5
This topic was automatically closed after 166 days. New replies are no longer allowed.