-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Ensure accurate app/device info after restart (match Android SDK…
… behavior) * Store app and device info in session record This brings the iOS SDK in line with the Android SDK to ensure that session begin and end events always have the same app and device info such as app and iOS versions. Previously, if the app was updated before all sessions were finished, the end session event would have the new app version and not match up with the begin session event. This could also apply to any additional events from that previous session that were waiting to be uploaded. * Fix thread deadlock race condition in MPApplication After finally getting it to reproduce reliably, I was able to narrow the problem down to the call to the `badgeNumber` property accessor in `MPApplication`. The root issue was the fact that the `applicationIconBadgeNumber` property of `UIApplication` must be read from the main thread, so there was a dispatch_sync to the main queue used to read it. However, after moving the timing of that read from the time of event upload to the time of session creation, it could trigger a deadlock if the main thread happened to currently be dispatch_syncing a block to the serial message queue while this was running on the message queue and dispatch_syncing to the main queue. To address this, I’ve changed the behavior of this property to instead read from user defaults and to update that value when `MPStateMachine` is initialized, as well as when the app enters the background or foreground (also inside `MPStateMachine` for consistency). This removes the need for the dispatch_sync at all as user defaults is thread safe and the updating of the value always happens on the main thread (or is asynced to the main thread if not).
- Loading branch information
1 parent
c274e42
commit e1fdc94
Showing
10 changed files
with
190 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.