urbanairship / ios-library

Urban Airship iOS SDK
http://urbanairship.com
Apache License 2.0
478 stars 265 forks source link

UAPreferenceDataStore Crash #287

Closed iwt-dahlborn closed 3 years ago

iwt-dahlborn commented 3 years ago

Preliminary Info

What Airship dependencies are you using?

Airship 14.5.0

What are the versions of any relevant development tools you are using?

Xcode 12.5.1, Swift Package Manager

Report

What unexpected behaviour are you seeing?

Crashes in -[UAPreferenceDataStore setObject:forKey:].

What is the expected behaviour?

That it does not crash.

What are the steps to reproduce the unexpected behaviour?

Reproducing this crash is relatively hard, you have to observe the standard UserDefaults. Then while airship is writing into the defaults, the observer needs to be deallocated at the same time.

Do you have logging for the issue?

https://gist.github.com/iwt-dahlborn/fcfb9a70c3d6b3109128a56d7b2f529b

I am pretty sure that this crash is the same issue described here: https://github.com/google/google-toolbox-for-mac/issues/238

Which would practically mean that it is an apple/UserDefaults issue that needs to be worked around. We will try to work around it in our key value observations as well, but I think you could mitigate this issue too by using an extra UserDefaults suite for airship (better solution) or dispatching your UserDefaults calls onto the main thread.

marc-scig commented 3 years ago

Hi @iwt-dahlborn,

Thanks for the report. We'll look into this.

rlepinski commented 3 years ago

We will be releasing a patch tomorrow that migrates our store to our own suite. Thanks for the report.

rlepinski commented 3 years ago

Released in 14.6.1