Appboy / appboy-ios-sdk

Public repo for the Braze iOS SDK
https://www.braze.com
Other
164 stars 142 forks source link

[Bug]: From 4.2.0 to 4.5.4, deviceToken registration fails. No push dialog box is displayed #362

Closed yangyang-wen closed 10 months ago

yangyang-wen commented 1 year ago

Platform

iOS

Platform Version

iOS 16.4

Braze SDK Version

4.5.4

Xcode Version

Xcode 14.3.1

Integration Method

Cocoapods

Computer Processor

Apple (M1)

Repro Rate

100%

Steps To Reproduce

  1. Add pod 'Appboy-iOS-SDK' 4.5.4 to the Podspec file.
  2. Add [Appboy startWithApiKey:inApplication:withLaunchOptions:];
  3. method in application:didFinishLaunchingWithOptions: method in AppDelegate.m.
  4. Run the app.

Expected Behavior

push dialog box should displayed, send messages should have push notification

Actual Incorrect Behavior

When pod installing 4.1.0, the push box will pop up and push notifications will be received, but not after 4.1.0

Verbose Logs

No response

Additional Information

No response

jerielng commented 1 year ago

Hi @yangyang-wen, could you provide some additional details on which iOS versions your app supports as well as how you are requesting the push permissions? To note, there are some distinctions in our integration docs around iOS 10+ and pre-iOS 10 push registration. Could you verify if your implementation matches those steps accordingly?

yangyang-wen commented 1 year ago

Hey @jerielng , our app supports iOS14-iOS16. we request push permissions use this.

 let center = UNUserNotificationCenter.current()
   let options: UNAuthorizationOptions = [.alert, .sound, .badge]
    center.requestAuthorization(options: options) { granted, _ in
      Appboy.sharedInstance()?.pushAuthorization(fromUserNotificationCenter: granted)
    }
yangyang-wen commented 1 year ago

I pod install v4.1.0, Push notfication is OK, but after version, won't display the push notfication Box.

jerielng commented 1 year ago

Hey @yangyang-wen, I'm having difficulty reproducing this issue from our end. Are you able to step through the authorization request process and noticing where in your code it might be failing/not being triggered? Is there also anything else you can share about how you are implementing the notification handlers in your app that might help shed light on the issue?

yangyang-wen commented 1 year ago

My registration logic is the same as 4.1.0, the difference is that when I install pod 'Appboy-iOS-SDK '4.5.4 when I install for the first time, I will not play the push message box. When I switch to pod 'Appboy-iOS-SDK '4.1.0, this message pops up. The specific screen recording is as follows:

4.5.4 There is no push box

https://github.com/Appboy/appboy-ios-sdk/assets/127808028/9a0b95dd-cd31-464a-a2ad-348a961a43a1

4.1.0 There has a push box

https://github.com/Appboy/appboy-ios-sdk/assets/127808028/9bc0a07d-8e09-4a66-9372-17db29b492ec

jerielng commented 1 year ago

Hi @yangyang-wen, as a minimal reproducible scenario, that method call center.requestAuthorization should be all you need to display the push permissions dialog box. For context, the display of this prompt is managed by the iOS UserNotifications framework, and an upgrade to the Braze SDK shouldn't have consequences for this display. The Braze logic (Appboy.sharedInstance()?.pushAuthorization(fromUserNotificationCenter: granted)) is only executed after the push permissions have been accepted.

For a sanity check, can you cross-reference our sample app, which has a working example?

Additionally, we would recommend setting a breakpoint in your push registration code to determine where it's getting stopped and why it may not be getting triggered.

If the above doesn't work, could you write in to our support team at support@braze.com with further details on this case and a link to this GitHub issue for context?

yangyang-wen commented 12 months ago

Thanks @jerielng , I will cross-reference your sample app, when I finished, I will let you know.

yangyang-wen commented 10 months ago

Has solved.

hokstuff commented 10 months ago

Thanks for getting back to us. I'll close out this issue since it has been solved.