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?


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



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

This topic was automatically closed after 166 days. New replies are no longer allowed.