DebugViewModel: fixed runtime crash on iOS < 16#3139
Merged
Conversation
Fixes RevenueCat/purchases-capacitor#100 and https://app.circleci.com/pipelines/github/RevenueCat/purchases-ios/14093/workflows/b3f8d001-6f39-40db-a5c5-00fc37d0211e/jobs/105838 Both `XCTest` (to load tests at runtime) and `Capacitor` use `objc_getClassList`. That's broken before iOS 16 and will try to load the metadata for `DebugViewModel` even though it's not `@available`. A similar issue has been reported before: https://openradar.appspot.com/radar?id=4970535809187840 / swiftlang/swift#58099 This adds a layer of indirection so loading `DebugViewModel` at runtime doesn't require the metadata for `NavigationPath`.
tonidero
approved these changes
Sep 5, 2023
This was referenced Sep 5, 2023
NachoSoto
pushed a commit
that referenced
this pull request
Sep 5, 2023
**This is an automatic release.** ### Bugfixes * `DebugViewModel`: fixed runtime crash on iOS < 16 (#3139) via NachoSoto (@NachoSoto) ### Performance Improvements * `PurchasesOrchestrator`: return early if receipt has no transactions when checking for promo offers (#3123) via Mark Villacampa (@MarkVillacampa) * `Purchases`: don't clear intro eligibility / purchased products cache on first launch (#3067) via NachoSoto (@NachoSoto) ### Dependency Updates * `SPM`: update `Package.resolved` (#3130) via NachoSoto (@NachoSoto) ### Other Changes * `ReceiptParser`: fixed SPM build (#3144) via NachoSoto (@NachoSoto) * `carthage_installation_tests`: optimize SPM package loading (#3129) via NachoSoto (@NachoSoto) * `CI`: add workaround for `Carthage` timing out (#3119) via NachoSoto (@NachoSoto) * `Integration Tests`: workaround to not lose debug logs (#3108) via NachoSoto (@NachoSoto)
MarkVillacampa
pushed a commit
that referenced
this pull request
Sep 6, 2023
Fixes RevenueCat/purchases-capacitor#100 and https://app.circleci.com/pipelines/github/RevenueCat/purchases-ios/14093/workflows/b3f8d001-6f39-40db-a5c5-00fc37d0211e/jobs/105838 ``` Thread 0 Crashed:: Dispatch queue: com.apple.main-thread 0 ??? 0x0 ??? 1 libswiftCore.dylib 0x18f9b8cf8 swift_getSingletonMetadata + 956 2 RevenueCat 0x107f42de4 type metadata accessor for DebugViewModel + 64 3 libobjc.A.dylib 0x18017d938 realizeClassMaybeSwiftMaybeRelock(objc_class*, mutex_tt<false>&, bool) + 116 4 libobjc.A.dylib 0x180184eb0 realizeAllClasses() + 168 5 libobjc.A.dylib 0x180187b3c objc_copyClassList + 36 6 XCTestCore 0x10532fcb0 +[XCTestCase(RuntimeUtilities) _allSubclasses] + 36 7 XCTestCore 0x10532fdb8 +[XCTestCase(RuntimeUtilities) allSubclasses] + 16 ``` Both `XCTest` (to load tests at runtime) and `Capacitor` use `objc_getClassList`. That's broken before iOS 16 and will try to load the metadata for `DebugViewModel` even though it's not `@available`. A similar issue has been reported before: https://openradar.appspot.com/radar?id=4970535809187840 / swiftlang/swift#58099 This adds a layer of indirection so loading `DebugViewModel` at runtime doesn't require the metadata for `NavigationPath`.
MarkVillacampa
pushed a commit
that referenced
this pull request
Sep 6, 2023
**This is an automatic release.** ### Bugfixes * `DebugViewModel`: fixed runtime crash on iOS < 16 (#3139) via NachoSoto (@NachoSoto) ### Performance Improvements * `PurchasesOrchestrator`: return early if receipt has no transactions when checking for promo offers (#3123) via Mark Villacampa (@MarkVillacampa) * `Purchases`: don't clear intro eligibility / purchased products cache on first launch (#3067) via NachoSoto (@NachoSoto) ### Dependency Updates * `SPM`: update `Package.resolved` (#3130) via NachoSoto (@NachoSoto) ### Other Changes * `ReceiptParser`: fixed SPM build (#3144) via NachoSoto (@NachoSoto) * `carthage_installation_tests`: optimize SPM package loading (#3129) via NachoSoto (@NachoSoto) * `CI`: add workaround for `Carthage` timing out (#3119) via NachoSoto (@NachoSoto) * `Integration Tests`: workaround to not lose debug logs (#3108) via NachoSoto (@NachoSoto)
tonidero
added a commit
that referenced
this pull request
Sep 14, 2023
### Description We found that there was another runtime crash in Capacitor in iOS < 15 similar to #3139. This applies the same fix to this new crash.
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.
Fixes RevenueCat/purchases-capacitor#100 and https://app.circleci.com/pipelines/github/RevenueCat/purchases-ios/14093/workflows/b3f8d001-6f39-40db-a5c5-00fc37d0211e/jobs/105838
Both
XCTest(to load tests at runtime) andCapacitoruseobjc_getClassList. That's broken before iOS 16 and will try to load the metadata forDebugViewModeleven though it's not@available.A similar issue has been reported before: https://openradar.appspot.com/radar?id=4970535809187840 / swiftlang/swift#58099
This adds a layer of indirection so loading
DebugViewModelat runtime doesn't require the metadata forNavigationPath.