NetworkOperation: workaround for iOS 12 crashes#2008
Merged
Conversation
aboedo
requested changes
Oct 28, 2022
aboedo
left a comment
Member
There was a problem hiding this comment.
OMG 🤦🏻♂️
I'm so glad we have a workaround!! 🎉🎉🎉
I'd just add some explanation for future us and 🚢
Comment on lines
45
to
51
Member
There was a problem hiding this comment.
let's definitely leave a note here explaining why it's important to use keyPath here, there's no way a maintainer would guess it if they're not familiar
Member
There was a problem hiding this comment.
we can even link to the discussion with a rebrandly link or something
Contributor
Author
|
I'll update with a comment. I forgot to mention that this is obviously well tested. Removing the KVO lines breaks all sorts of tests so there's good coverage of this. |
This _might_ fix [CSDK-503]. The latest stacktrace provided gave me a clue: > Fatal error: Should never be reached: file /BuildRoot/Library/Caches/com.apple.xbs/Sources/swiftlang_overlay_Foundation_Device/swiftlang-1001.2.63.13/swift/stdlib/public/SDK/Foundation/NSObject.swift, line 46 > 0xa3d10 @objc static NSObject.__old_unswizzled_keyPathsForValuesAffectingValue(forKey:) + 84 >53 libswiftFoundation.dylib 0xa436c static __KVOKeyPathBridgeMachinery.keyPathsForValuesAffectingValue(forKey:) + 272 >64 libswiftFoundation.dylib 0xa4864 @objc static __KVOKeyPathBridgeMachinery.keyPathsForValuesAffectingValue(forKey:) + 88 That crash is coming from [here](https://github.com/apple/swift-corelibs-foundation/blob/swift-DEVELOPMENT-SNAPSHOT-2022-10-24-a/Darwin/Foundation-swiftoverlay/NSObject.swift#L47). KVO shipped broken on Swift at least throughout iOS 12.x (see swiftlang/swift-corelibs-foundation#3742) Thanks to @jckarter for [suggesting this workaround](https://twitter.com/jckarter/status/1586029206646898688?s=61&t=LJyPWVeXcT9TfIL2zMjFng).
324f9d3 to
398158e
Compare
aboedo
approved these changes
Oct 28, 2022
Contributor
Author
|
Thanks Elon. |
Merged
NachoSoto
pushed a commit
that referenced
this pull request
Nov 4, 2022
### New Features * Introduced `PurchasesDiagnostics` to help diagnose SDK configuration errors (#1977) via NachoSoto (@NachoSoto) ### Bugfixes * Avoid posting empty receipts by making`TransactionsManager` always use `SK1` implementation (#2015) via NachoSoto (@NachoSoto) * `NetworkOperation`: workaround for iOS 12 crashes (#2008) via NachoSoto (@NachoSoto) ### Other Changes * Makes hold job wait for installation tests to pass (#2017) via Cesar de la Vega (@vegaro) * Update fastlane-plugin-revenuecat_internal (#2016) via Cesar de la Vega (@vegaro) * `bug_report.md`: changed SK2 wording (#2010) via NachoSoto (@NachoSoto) * Added `Set + Set` and `Set += Set` operators (#2013) via NachoSoto (@NachoSoto) * fix the link to StoreKit Config file from watchOS purchaseTester (#2009) via Andy Boedo (@aboedo) * `PurchaseTesterSwiftUI`: combined targets into one multi-platform and fixed `macOS` (#1996) via NachoSoto (@NachoSoto) * Less Array() (#2005) via SabinaHuseinova (@SabinaHuseinova) * Docs: fixed `logIn` references (#2002) via NachoSoto (@NachoSoto) * CI: use `Xcode 14.1` (#1992) via NachoSoto (@NachoSoto) * `PurchaseTesterSwiftUI`: fixed warnings and simplified code using `async` methods (#1985) via NachoSoto (@NachoSoto)
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This might fix CSDK-503.
The latest stacktrace provided gave me a clue:
That crash is coming from here.
KVO shipped broken on Swift at least throughout iOS 12.x (see swiftlang/swift-corelibs-foundation#3742)
Thanks to @jckarter for suggesting this workaround.