pushy / pushy-flutter

The official Pushy SDK for Flutter apps.
Apache License 2.0
21 stars 19 forks source link

iOS Push permission deined #51

Closed vavdiyaharesh closed 1 year ago

vavdiyaharesh commented 1 year ago

image

I have already setup all required steps for pushy to work in iOS and it also working on debug and Testflight mode but when i submit app to review then its getting rejected as shown in above image.

pushy commented 1 year ago

Hi @vavdiyaharesh, Thanks for creating this issue. We'd be glad to assist.

It looks like the iOS review team tried to see what happens when users deny your app the push notification permission. When the permission is denied, pushy.register() will throw an error. It seems that your app has been programmed in a way that if pushy.register() returns an error, it is not possible to continue logging into your app/using your app. This is most likely the reason the app review has failed.

Consider changing your app's logic so that users can keep logging in even if the pushy.register() method errors out:

// Initialize Pushy SDK
let pushy = Pushy(UIApplication.shared)

// Register the user for push notifications
pushy.register({ (error, deviceToken) in
    // Log errors but don't display any error dialog and allow login
    if error != nil {
        return print ("Registration failed: \(error!.localizedDescription)")
    }

    // Print device token to console
    print("Pushy device token: \(deviceToken)")

    // Persist the token locally and send it to your backend later
    UserDefaults.standard.set(deviceToken, forKey: "pushyToken")
})

Please let us know if this makes sense, and if you have any further questions.