Appboy / appboy-ios-sdk

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

flushDataAndProcessRequestQueue doesn't work when the app is going to background state #117

Closed PattoMotto closed 7 years ago

PattoMotto commented 7 years ago

Report

flushDataAndProcessRequestQueue doesn't work when the user taps lock screen button after the app log custom event.

Describe your environment.

Info Value
Platform Name ios
Platform Version 10.3
SDK Version 2.30.0
Integration Method cocoapods
Xcode Version Xcode 8.3.3
Repro rate

What did you do?

I try to flush the data before the app go to background (lock screen button) ABKRequestProcessingPolicy is default ABKAutomaticRequestProcessing

I also test with the home button, it's work fine.

What did you expect to happen?

A custom event should be sent.

What happened instead?

No event send out.

Steps to reproduce

  1. log custom event
  2. lock screen

Code Snippet

- (void)applicationWillResignActive:(UIApplication *)application {
    [[Appboy sharedInstance] flushDataAndProcessRequestQueue];
}
sen-lu commented 7 years ago

Hi @neungnarakjung,

We were unable to reproduce the issue in our sample app using the following reproduction steps:

  1. Adding the following code to our sample app:
    - (void)applicationWillResignActive:(UIApplication *)application {
    [[Appboy sharedInstance] flushDataAndProcessRequestQueue];
    }
  2. Initializing Appboy with the default ABKAutomaticRequestProcessing policy
  3. Logging a custom event
  4. Pressing the lock screen button before the custom event was automatically flushed

Using the above steps, we saw that the custom event was flushed after the app was backgrounded.

Can you confirm that the call to [[Appboy sharedInstance] logCustomEvent:] is successfully made before the user clicks the lock screen button? Additional code samples around where you log the custom event in question and any other related code would be extremely helpful in troubleshooting further, as well as a test or live application that we can reproduce the issue on. If you'd prefer to share code samples in a private medium, you can email support@appboy.com and cc me directly at tiffany@appboy.com.

Best, Tiff

PattoMotto commented 7 years ago

Thanks @tiffanylu

Appboy sample app it's work like you said. I've to check in my app, maybe some of my tasks block the AppboySDK request (in the small amount of time before suspended).

Cheers, Pat