purchases-ios: Showing CustomerCenterView() crashes the app since my rollout today

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.

  1. Environment

    1. Platform: iOS 17 / iOS 18
    2. SDK version: 5.14.6 and 5.17.0
    3. StoreKit version:
      • StoreKit 1 (default on versions <5.0.0. Can be enabled in versions >=5.0.0 with .with(storeKitVersion: .storeKit1))
      • StoreKit 2 (default on versions >=5.0.0)
    4. OS version:
    5. Xcode version: 16.2
    6. Device and/or simulator:
      • Device
      • Simulator
    7. Environment:
      • Sandbox
      • TestFlight
      • Production
    8. 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.
  2. Debug logs that reproduce the issue. Complete logs with Purchases.logLevel = .verbose will 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""

  1. 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.

About this issue

  • Original URL
  • State: open
  • Created 2 years ago
  • Comments: 22 (11 by maintainers)

Most upvoted comments

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.

I’ve sent them also to your gmail address. Did that work?

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 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

@ikemuc for the heads up, you can disable the update warning from the dashboard.

Image

@ikemuc would it be too much to ask for the logs =)?

Complete logs with Purchases.logLevel = .verbose will help us debug this issue.

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

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…

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…

Even simpler - This is enough:

import SwiftUI
import SwiftData
import XCGLogger
import RevenueCatUI

@main
struct SunOnlyApp: App {
    var body: some Scene {
        WindowGroup {
            CustomerCenterView()
        }
   }
}

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)
}

} `

👀 We’ve just linked this issue to our internal tracker and notified the team. Thank you for reporting, we’re checking this out!