Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Showing CustomerCenterView() crashes the app since my rollout today #4790

Open
11 of 12 tasks
ikemuc opened this issue Feb 17, 2025 · 15 comments
Open
11 of 12 tasks

Showing CustomerCenterView() crashes the app since my rollout today #4790

ikemuc opened this issue Feb 17, 2025 · 15 comments
Assignees
Labels

Comments

@ikemuc
Copy link

ikemuc commented Feb 17, 2025

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.

@ikemuc ikemuc added the bug label Feb 17, 2025
@RCGitBot
Copy link
Contributor

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

@facumenzella facumenzella self-assigned this Feb 17, 2025
@facumenzella
Copy link
Contributor

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

@ikemuc
Copy link
Author

ikemuc commented Feb 17, 2025

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

}
`

@ikemuc
Copy link
Author

ikemuc commented Feb 17, 2025

Even simpler - This is enough:

import SwiftUI
import SwiftData
import XCGLogger
import RevenueCatUI

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

@ikemuc
Copy link
Author

ikemuc commented Feb 17, 2025

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

@facumenzella
Copy link
Contributor

I think this is the root cause @ikemuc #4792
Can you try that commit?

@ikemuc
Copy link
Author

ikemuc commented Feb 18, 2025

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

@ikemuc
Copy link
Author

ikemuc commented Feb 18, 2025

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

@facumenzella
Copy link
Contributor

facumenzella commented Feb 18, 2025

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

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

@facumenzella
Copy link
Contributor

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

Image

@ikemuc
Copy link
Author

ikemuc commented Feb 18, 2025

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?

@facumenzella
Copy link
Contributor

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
Copy link
Author

ikemuc commented Feb 19, 2025

Here comes the log with verbose loglevel.

revenuecat.log

@ikemuc
Copy link
Author

ikemuc commented Feb 19, 2025

Yep, I tried switching of the update warning. It still crashes...

@facumenzella
Copy link
Contributor

@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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants