Instabug / Instabug-SP

Other
11 stars 11 forks source link

Crash in "Error -[NSURLRequest(Additions) ibg_isWebViewRequest]" #32

Open fzy-github opened 11 months ago

fzy-github commented 11 months ago

Steps to Reproduce the Problem

No steps, app crashes sometimes

Expected Behavior

there is no crash

Actual Behavior

app crashes

Instabug integration code

Instabug.start(withToken: Constants.Instabug.token, invocationEvents: .none)
Instabug.willSendReportHandler = { report in
            // attach our log files
            let logFileUrls = self.sortedLogFilePaths.map { URL(fileURLWithPath: $0) }
            let maxLogFileCount = min(logFileUrls.count, Constants.Instabug.maxNumberOfLogFiles)
            let logFilesToAttach = logFileUrls[0..<maxLogFileCount]
            logFilesToAttach.forEach {
                report.addFileAttachment(with: $0)
            }

            report.setUserAttribute("value1", withKey: "key1")
            report.setUserAttribute("value2", withKey: "key2")
            // .. and few more

            if let fontSizeType = DynamicTypeSize(UITraitCollection.current.preferredContentSizeCategory) {
                report.setUserAttribute(fontSizeType.name, withKey: Constants.Instabug.fontSizeType)
            }

            return report
        }

SDK Version

12.1.0

iOS Version

16.6.1

Device Model

iPhone XS Max iPhone 14 etc

[Optional] Project That Reproduces the Issue

N/A crash happens sometimes only, no steps identified to reproduce

Stacktrace:

OS Version: iOS 16.6.1 (20G81)
Report Version: 104

Exception Type: EXC_BREAKPOINT (SIGTRAP)
Crashed Thread: 0

Application Specific Information:
Signal 5, Code 0

Thread 0 Crashed:
0   CoreFoundation                  0x3110a85b0         CFDictionaryGetCount
1   CFNetwork                       0x313099b04         _CFNetworkHTTPConnectionCacheSetLimit
2   CFNetwork                       0x31305b4f8         CFHTTPCookieCopyRequestHeaderFields
3   Instabug                        0x10870ca9c         -[NSURLRequest(Additions) ibg_isWebViewRequest]
4   Instabug                        0x1086de6d0         -[IBGNetworkLoggerController canServeRequest:]
5   Instabug                        0x108776a3c         NetworkTasksListener.createTask
6   Instabug                        0x108776ed0         NetworkTasksListener.taskDidStart
7   Instabug                        0x108839c28         __71-[IBGSwizzler newImplementatioDataTaskDidResume:selector:swizzlerInfo:]_block_invoke_3
8   libdispatch.dylib               0x31f9b631c         _dispatch_call_block_and_release
9   libdispatch.dylib               0x31f9b7ea8         _dispatch_client_callout
10  libdispatch.dylib               0x31f9c66a0         _dispatch_main_queue_drain
11  libdispatch.dylib               0x31f9c62f0         _dispatch_main_queue_callback_4CF
12  CoreFoundation                  0x3110b2c24         __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__
13  CoreFoundation                  0x31109455c         __CFRunLoopRun
14  CoreFoundation                  0x3110993e8         CFRunLoopRunSpecific
15  GraphicsServices                0x387b43358         GSEventRunModal
16  UIKitCore                       0x315494f54         -[UIApplication _run]
17  UIKitCore                       0x315494bb8         UIApplicationMain
18  SwiftUI                         0x3182fec4c         OUTLINED_FUNCTION_895
19  SwiftUI                         0x3182651e8         block_copy_helper.1
20  SwiftUI                         0x31824f290         OUTLINED_FUNCTION_901
21  SampleApp                       0x202fa7608         [inlined] AppLauncher.main
22  SampleApp                       0x202fa7608         [inlined] AppLauncher.$main (<compiler-generated>:6)
23  SampleApp                       0x202fa7608         main
24  <unknown>                       0x1a95a0dec         <redacted>
ahmedsalah196 commented 11 months ago

Hello @fzy-spyro, We're working on a fix for this

fzy-github commented 11 months ago

Thanks for the update!