Group Group Group Group Group Group Group Group Group

Error with tutorial Push Notifications

Hi in the Push Notifications Tutorial: Getting Started I am getting the error “Cannot find ‘self’ in scope” under
func registerForPushNotifications()

Any ideas how to clear error?
Thank you

@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?

Sure

func registerForPushNotifications() {
UNUserNotificationCenter.current()
.requestAuthorization(
options: [.alert, .sound, .badge]) { [weak self] granted, _ in
print(“Permission granted: (granted)”)
guard granted else { return }
self?.getNotificationSettings()

  }

}

So sorry. It was my fault. I put the function outside of the AppDelegate class. opps!. Thanks for your time