pendo-io / pendo-mobile-sdk

Pendo captures product usage data, gathers user feedback, and lets you communicate in-app to onboard, educate, and guide users to value
https://www.pendo.io
Other
57 stars 2 forks source link

SDK 2.20.0-swiftui crashes right after the app start #24

Closed ondrejstasek closed 1 year ago

ondrejstasek commented 1 year ago

Found unexpected null pointer value while trying to cast value of type 'UIViewController' (0x7fbb8301afe0) to 'PendoSDK.PNDHostingControllerProtocol' (0x7fbb8301aff8) CoreSimulator 857.13 - Device: iPhone 14 (D753AE2B-9ADC-407A-807A-554113E8F77C) - Runtime: iOS 16.1 (20B72) - DeviceType: iPhone 14

-------------------------------------
Translated Report (Full Report Below)
-------------------------------------

Incident Identifier: 5CFDA17B-1C22-4F88-A105-60B8178D26BE
CrashReporter Key:   13ED150A-B741-FEE2-EB62-6F6BE20E69C6
Hardware Model:      MacBookPro16,1
Code Type:           X86-64 (Native)
Role:                Foreground
Parent Process:      launchd_sim [83923]
Coalition:           com.apple.CoreSimulator.SimDevice.D753AE2B-9ADC-407A-807A-554113E8F77C [191596]
Responsible Process: SimulatorTrampoline [12696]

Date/Time:           2022-12-08 10:02:05.9965 +0100
Launch Time:         2022-12-08 10:02:03.8065 +0100
OS Version:          macOS 13.0 (22A380)
Release Type:        User
Report Version:      104

Exception Type:  EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Triggered by Thread:  0

Thread 0 Crashed:: UI Dispatch queue: com.apple.main-thread
0   libsystem_kernel.dylib                 0x10dc3d30e __pthread_kill + 10
1   libsystem_pthread.dylib                0x10db86f7b pthread_kill + 263
2   libsystem_c.dylib                      0x10db2107a __abort + 139
3   libsystem_c.dylib                      0x10db20fef abort + 145
4   libswiftCore.dylib                     0x10ec38025 swift::fatalErrorv(unsigned int, char const*, __va_list_tag*) + 133
5   libswiftCore.dylib                     0x10ec380ab swift::fatalError(unsigned int, char const*, ...) + 123
6   libswiftCore.dylib                     0x10ec3478a getNonNullSrcObject(swift::OpaqueValue*, swift::TargetMetadata<swift::InProcess> const*, swift::TargetMetadata<swift::InProcess> const*) + 218
7   libswiftCore.dylib                     0x10ec33d26 tryCast(swift::OpaqueValue*, swift::TargetMetadata<swift::InProcess> const*, swift::OpaqueValue*, swift::TargetMetadata<swift::InProcess> const*, swift::TargetMetadata<swift::InProcess> const*&, swift::TargetMetadata<swift::InProcess> const*&, bool, bool) + 774
8   libswiftCore.dylib                     0x10ec338ec swift_dynamicCast + 156
9   Pendo                                  0x109bd7fbf specialized static DumpTree.pnd_dump(controller:name:indent:maxDepth:printingOption:descriptionLength:pruneEnabled:) + 111
10  Pendo                                  0x109bd75ed @objc static DumpTree.pnd_dump(controller:name:indent:maxDepth:printingOption:descriptionLength:pruneEnabled:) + 125
11  Pendo                                  0x109bc3d1b -[PNDScreenManager swiftUIDataAppend:fromWindow:] + 204
12  Pendo                                  0x109bc37c2 -[PNDScreenManager screenDataFor:] + 284
13  Pendo                                  0x109bc3418 -[PNDScreenManager screenChanged] + 68
14  Pendo                                  0x109bc2d18 __44-[PNDScreenManager triggerScreenScanOfType:]_block_invoke.118 + 622
15  Pendo                                  0x109bb18a2 -[PNDDebouncer fireNow] + 36
16  Foundation                             0x10b441266 __NSFireTimer + 67
17  CoreFoundation                         0x10a019819 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 20
18  CoreFoundation                         0x10a019363 __CFRunLoopDoTimer + 812
19  CoreFoundation                         0x10a018ada __CFRunLoopDoTimers + 243
20  CoreFoundation                         0x10a013322 __CFRunLoopRun + 2126
21  CoreFoundation                         0x10a0126f7 CFRunLoopRunSpecific + 560
22  GraphicsServices                       0x10fc9228a GSEventRunModal + 139
23  UIKitCore                              0x11cdb262b -[UIApplication _run] + 994
24  UIKitCore                              0x11cdb7547 UIApplicationMain + 123
25  App                                    0x102c4188d main + 285 (main.m:22)
26  dyld_sim                               0x1065fc2bf start_sim + 10
27  dyld                                   0x10699e310 start + 2432
MikePendo commented 1 year ago

Damn, we just released a new version yesterday. I am wondering on which version u r. If you open Package dependencies -> Pendo -> Package what is the url u have there? Strange I cant reproduce any thing similar

MikePendo commented 1 year ago

Ok will fix in couple of minutes. The interesting thing is how do we get to it, any chance u could share code snippets of your app structure. i.e the initial code of your view hierarchy not the content BUT the high level design u r using. For instance in my sample app I have the following:

@main
struct AvocadosApp: App {
    let persistenceController = PersistenceController.shared
    @UIApplicationDelegateAdaptor(AppDelegate.self) var appDelegate
    @State var selected = 4
    var body: some Scene {
        print("AvocadosApp body entry")
        return WindowGroup {
            WithPendo() {
                return TabView() {
                       let _ = print("TabView1111")
                       AvocadosView().tabItem {
                           Image("tabicon-branch")
                           Text("Avocados")
                       }.tag(0)

                       ContentView(facts: factsData, recipes: recipesData).tabItem {
                           Image("tabicon-book")
                           Text("Recipes")
                       }.tag(1)
                       .navigationTitle("Recipes")

                       RipeningStagesView().tabItem {
                           Image("tabicon-avocado")
                           Text("Ripening")
                       }.tag(2)

                       SettingsView().tabItem {
                           Image("tabicon-settings")
                           Text("Settings")
                       }.tag(3)

                       TestView().tabItem {
                           Image(systemName: "pencil.circle")
                           Text("Test")
                           //Label("Editor", systemImage: "pencil.circle")
                           //Text("Editor")
                       }.tag(4)
                   }
                   .edgesIgnoringSafeArea(.top)
                   .accentColor(.primary)
                   .onOpenURL(perform: handleURL)
            }
        }
    }
MikePendo commented 1 year ago

please use the latest version it should be 2.20.0.6599

ondrejstasek commented 1 year ago

please use the latest version it should be 2.20.0.6599

Looks good 👍🏻

MikePendo commented 1 year ago

@ondrejstasek any chance u could share a small high level structure of your app (the initial part) . I would like to understand how do we got to this case?