Showing CustomerCenterView() crashes the app since my rollout today
- [X] I have updated Purchases SDK to the latest version
- [X] I have read the Contribution Guidelines
- [X] I have searched the Community
- [X] I have read docs.revenuecat.com
- [X] I have searched for existing Github issues
Since today's launch of my App in the Apple App Store, whenever you want to show CustomerCenterView(), my App crashes immediately.
When I go back to former versions, no crash happens, but instead of the regular CustomerCenterView I see a message "Update verfügbar. Bitte die App aktualisieren, damit alles korrekt funktioniert." (Translated: "Update available. Please update the app to ensure everything works correctly.") Below there are 2 buttons, one to Upgrade, which leads to my app's App Store page, and the other to continue. When I press continue in the old versions, the regular customer center appears.
But as I said: With my new version it crashes immediately.
-
Environment
- Platform: iOS 17 / iOS 18
- SDK version: 5.14.6 and 5.17.0
- StoreKit version:
- [ ] StoreKit 1 (default on versions <5.0.0. Can be enabled in versions >=5.0.0 with
.with(storeKitVersion: .storeKit1)) - [x] StoreKit 2 (default on versions >=5.0.0)
- [ ] StoreKit 1 (default on versions <5.0.0. Can be enabled in versions >=5.0.0 with
- OS version:
- Xcode version: 16.2
- Device and/or simulator:
- [X] Device
- [X] Simulator
- Environment:
- [X] Sandbox
- [X] TestFlight
- [X] Production
- How widespread is the issue. Percentage of devices affected. Apple released my App in the new version and all of my devices (3) and all of the simulators crash.
-
Debug logs that reproduce the issue. Complete logs with
Purchases.logLevel = .verbosewill help us debug this issue.
When I set a breakpoint to All Exceptions, it stops in the "structure MyApp: App" line with:
"Thread 1: "-[__SwiftValue set]: unrecognized selector sent to instance 0x600000c263d0""
- Steps to reproduce, with a description of expected vs. actual behavior
Call a SwiftUI View, which includes CustomerCenterView(). It should open and display the data. But it crashes the whole app.
👀 We've just linked this issue to our internal tracker and notified the team. Thank you for reporting, we're checking this out!
@ikemuc how are you showing CustomerCenterView? Would it be too much to ask for the code snippet?
I assume you're using it straight away, but I wonder if you're wrapping it inside a NavigationStack, NavigationView, or presenting it.
This is the code currently:
` import Foundation import SwiftUI import RevenueCatUI
struct CustomerCenterSheetView: View { @Environment(MainModel.self) var mainModel @Environment(.presentationMode) var presentationMode
@State private var currentSheetHeight: CGFloat = 0
var body: some View {
@Bindable var mainModel = mainModel
Text("")
.sheet(isPresented: $mainModel.customerCenterVisible, onDismiss: {
onClose()
}) {
CustomerCenterView()
.foregroundColor(Color("uiForegroundDark"))
.presentationDetents([
.height(UISettings.customerCenteriOSSheetHeight),
])
.presentationDragIndicator(.visible)
.onDisappear { // necessary for iOS17
onClose()
}
}
}
private func onClose() {
mainModel.sheetWasClosed(mode: .customerCenter)
}
} `
Even simpler - This is enough:
import SwiftUI
import SwiftData
import XCGLogger
import RevenueCatUI
@main
struct SunOnlyApp: App {
var body: some Scene {
WindowGroup {
CustomerCenterView()
}
}
}
Some more research:
The crash also happens, when I build my App with purchases-ios 5.14.0 (the first version with CustomerCenterView).
I tried somethings else: When I switch the simulator or the device to airplane mode before opening the view containing CustomerCenterView(), I get an error message ("Es ist etwas schief gelaufen", i.e. "Something went wrong") instead of the crash.
=> Could this be a RevenueCat server problem? It looks like this, because my earlier app versions, which were working without any problems now show this strange "Update" warning...
I think this is the root cause @ikemuc https://github.com/RevenueCat/purchases-ios/pull/4792 Can you try that commit?
I tried it: CustomerCenterView() still crashes...
BTW: I reduced the pressure on me by replacing CustomerCenterView() with my old code in a nightly emergency rollout of a new version of SunOnly. So for me the fix isn't time critical any more...
Stacktrace is:
2025-02-18 10:26:16.606311+0100 SunOnly[31472:406087] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__SwiftValue set]: unrecognized selector sent to instance 0x600000c0eb50'
*** First throw call stack:
(
0 CoreFoundation 0x000000018048d8a8 __exceptionPreprocess + 172
1 libobjc.A.dylib 0x000000018008409c objc_exception_throw + 56
2 CoreFoundation 0x00000001804a26f8 +[NSObject(NSObject) instanceMethodSignatureForSelector:] + 0
3 CoreFoundation 0x00000001804919f8 ___forwarding___ + 1280
4 CoreFoundation 0x0000000180493d1c _CF_forwarding_prep_0 + 92
5 UIFoundation 0x0000000184657db8 -[NSCoreTypesetter _NSFastDrawString:length:attributes:paragraphStyle:typesetterBehavior:lineBreakMode:rect:padding:graphicsContext:baselineRendering:usesFontLeading:usesScreenFont:scrollable:syn 6 UIFoundation 0x0000000184659388 -[NSCoreTypesetter _stringDrawingCoreTextEngineWit
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__SwiftValue set]: unrecognized selector sent to instance 0x600000c0eb50'
*** First throw call stack:
(
0 CoreFoundation 0x000000018048d8a8 __exceptionPreprocess + 172
1 libobjc.A.dylib 0x000000018008409c objc_exception_throw + 56
2 CoreFoundation 0x00000001804a26f8 +[NSObject(NSObject) instanceMethodSignatureForSelector:] + 0
3 CoreFoundation 0x00000001804919f8 ___forwarding___ + 1280
4 CoreFoundation 0x0000000180493d1c _CF_forwarding_prep_0 + 92
5 UIFoundation 0x0000000184657db8 -[NSCoreTypesetter _NSFastDrawString:length:attributes:paragraphStyle:typesetterBehavior:lineBreakMode:rect:padding:graphicsContext:baselineRendering:usesFontLeading:usesScreenFont:scrollable:syn 6 UIFoundation 0x0000000184659388 -[NSCoreTypesetter _stringDrawingCoreTextEngineWithOriginalString:rect:padding:graphicsContext:forceClipping:attributes:stringDrawingOptions:drawingContext:stringDrawingInterface:] + 1156
7 UIKit 0x00000001bde92c6c -[NSCoreTypesetterAccessibility__UIKit__UIFoundation _stringDrawingCoreTextEngineWithOriginalString:rect:padding:graphicsContext:forceClipping:attributes:stringDrawingOptions:drawingContext:strin 8 UIFoundation 0x0000000184652dd4 __NSStringDrawingEngine + 1324
9 UIFoundation 0x0000000184653a34 -[NSAttributedString(NSExtendedStringDrawing) drawWithRect:options:context:] + 136
10 UIKitCore 0x00000001857311f0 -[UILabel _drawTextInRect:baselineCalculationOnly:returningDeviceMetricsOfFirstLine:forceMultiline:] + 5392
11 UIKitCore 0x000000018572f9f8 -[UILabel drawTextInRect:] + 408
12 UIKitCore 0x00000001857cd1a8 -[UIView(CALayerDelegate) drawLayer:inContext:] + 468
13 QuartzCore 0x0000000189ddcce4 CABackingStoreUpdate_ + 200
14 QuartzCore 0x0000000189f71a48 ___ZN2CA5Layer8display_Ev_block_invoke + 52
15 QuartzCore 0x0000000189f68420 -[CALayer _display] + 1580
16 QuartzCore 0x0000000189f7ac3c _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 392
17 QuartzCore 0x0000000189e963bc _ZN2CA7Context18commit_transactionEPNS_11TransactionEdPd + 460
18 QuartzCore 0x0000000189ec5bf0 _ZN2CA11Transaction6commitEv + 652
19 QuartzCore 0x0000000189ec70a4 _ZN2CA11Transaction25flush_as_runloop_observerEb + 68
20 CoreFoundation 0x00000001803ed648 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 32
21 CoreFoundation 0x00000001803e804c __CFRunLoopDoObservers + 528
22 CoreFoundation 0x00000001803e8504 __CFRunLoopRun + 968
23 CoreFoundation 0x00000001803e7d28 CFRunLoopRunSpecific + 572
24 GraphicsServices 0x000000018e7cdbc0 GSEventRunModal + 160
25 UIKitCore 0x00000001852bafdc -[UIApplication _run] + 868
26 UIKitCore 0x00000001852bec54 UIApplicationMain + 124
27 SwiftUI 0x00000001c4b04524 OUTLINED_FUNCTION_70 + 500
28 SwiftUI 0x00000001c4b043c4 OUTLINED_FUNCTION_70 + 148
29 SwiftUI 0x00000001c4816108 OUTLINED_FUNCTION_2 + 92
30 SunOnly.debug.dylib 0x0000000103821218 $s7SunOnly0aB3AppV5$mainyyFZ + 40
31 SunOnly.debug.dylib 0x0000000103821434 __debug_main_executable_dylib_entry_point + 12
32 dyld 0x0000000100b99558 start_sim + 20
33 ??? 0x0000000100d46274 0x0 + 4308886132
)
libc++abi: terminating due to uncaught exception of type NSException
@ikemuc would it be too much to ask for the logs =)?
Complete logs with Purchases.logLevel = .verbose will help us debug this issue.
@ikemuc for the heads up, you can disable the update warning from the dashboard.
Ah, I thought that CustomerCenterView() displays this message because of a necessary update of RevenueCat software... Now I understand the message...
Would disabling the warning message in the dashboard prevent the crash?
I don't think it's related tbh. Just so you know you can disable it :)
Whenever you have the logs, please also attach the user ID. That will narrow down the issue 🙏 @ikemuc
Yep, I tried switching of the update warning. It still crashes...
@ikemuc I've been trying to reproduce the crash without luck. Do you think we can schedule a call to debug and see what's going on? Just book some slot. Hopefully we'll figure it out pretty quickly
@ikemuc can you also send me the store kit config file please?
@ikemuc can you also share your localizable strings file?
Hi Facundo, I've sent you the files twice (friday and wednesday). Did you receive my e-mail(s)? Perhaps they are in your spam folder? Greetings, Eike
I've sent them also to your gmail address. Did that work?
@ikemuc does the crash persist if you use a different device language? (I wonder if it's caused by some string in your current localization)
@ikemuc have you been able to test the latest release? I wonder if the issue still persists with 5.28.0.
Hi @facumenzella, sorry for not responding! Currently I'm under heavy workload and I don't have a chance to test with the new version. I'll try to test it, when I have a little spare time.