InderKumarRathore/DeviceGuru

Crash EXC_BREAKPOINT

Closed this issue · 9 comments

Crashed: com.apple.main-thread
0  DeviceGuru                     0xf6f4 $s10DeviceGuru36HardwareDetailProviderImplementationV14hardwareStringSSvgTf4d_n + 816
1  DeviceGuru                     0x7894 $s10DeviceGuru0aB14ImplementationC15_hardwareString33_6D9CB63EE52D478D829B7739F6A9542CLLSSvg + 76
2  DeviceGuru                     0x7a10 $s10DeviceGuru0aB14ImplementationC8platformAA8PlatformOvg + 16
3  OurApp                        0x3bd620 SecureEnclaveService.hasSecureEnclave.getter + 14 (DeviceGuru+SecureEnclave.swift:14)

how we invoke DeviceGuru in our code:

extension DeviceGuru {
    func supportSecureEnclave() -> Bool {
        if platform == .iPodTouch { //line 14
            return false
        }
        ...    
   }

We've got a lot of crashes with such stack trace for iOS 13 and iOS 14 users.
DeviceGuru version is 10.0.1

Which version of the lib are you using?
Are you using cocoapods?

Yes, I am using cocoapods.
Version is 10.0.1.

Hi! Any updates? Are you going to look in it and possibly fix for a next release?

I tried but couldn't reproduce, can you zip a sample project that's causing it

I can not send a zip, because of NDA.

Can we collaborate together better to fix it?

Btw, It crashes only on iOS 13, 14, 15.
78% crashes on iOS 14.
Total 63K crashes for last 30 days.

// HardwareDetailProvider.swift
public var hardwareString: String {
        var name: [Int32] = [CTL_HW, HW_MACHINE]
        var size: Int = 2
        sysctl(&name, 2, nil, &size, nil, 0)
        var hw_machine = [CChar](repeating: 0, count: Int(size))
        sysctl(&name, 2, &hw_machine, &size, nil, 0)

        var hardware: String = String(cString: hw_machine) // problem is here

        // Check for simulator
        if hardware == "x86_64" || hardware == "i386" {
            if let deviceID = ProcessInfo.processInfo.environment["SIMULATOR_MODEL_IDENTIFIER"] {
                hardware = deviceID
            }
        }

        return hardware
    }

I'm not asking the actual project, but a sample project causing the crash. I would suggest you to create a new project and try to reproduce it. If you can't then there might be a problem how you're using this lib.
Also does the crashes happens on simulator? I don't have device for ios 15/14/13