ObjC - how to catch and rescue an exception in a different thread - ios

I'm building an app that uses a commercial third-party SDK for reading barcodes. The reader runs in the background, in it's own thread, which the SDK creates. As part of the setup, you assign a delegate that gets called whenever the SDK detects a valid barcode.
The problem is that the SDK occasionally throws an exception. I can see exactly where the problem is from the crash log, but since part of the SDK is compiled, I can't fix it.
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
While I wait for the SDK vendor to fix the problem, I was wondering if it is possible for my code to catch and rescue the exception?
Any ideas, much appreciate.

Related

Thread 0 name: Dispatch queue: com.apple.main-thread ios 13.4

My app is running fine with all the devices but only crashes with iphone Xr and the crash report looks like the:
Any help would be appreciated
file link https://drive.google.com/open?id=19lkVCSN9LuShROGXAErE_mNn6E-tO6up
The code on your main thread generated this EXC_BREAKPOINT (SIGTRAP) exception. You should symbolicate this log so you can see precisely where it crashed. Until you do that, you’re just guessing what the source of the problem is. A symbolicated log will tend to narrow down the problem to a particular line of code, from which you can start your diagnosis.
Re EXC_BREAKPOINT, Technical Note TN2151 says:
Swift code will terminate with this exception type if an unexpected condition is encountered at runtime such as:
a non-optional type with a nil value
a failed forced type conversion
Look at the Backtraces to determine where the unexpected condition was encountered. Additional information may have also been logged to the device's console. You should modify the code at the crashing location to gracefully handle the runtime failure. For example, use Optional Binding instead of force unwrapping an optional.
For what it’s worth, there’s a very good chance that the problem is not related to the fact that the device was an iPhone X𝖱, but something else related to that user’s device, settings, permissions, or environment.

I'm having All Exceptions Breakpoint problems [duplicate]

After upgrading to Xcode 11.3, our app throws an exception when running on an iOS 13.3 device. The exception does not occur at the same place every time, and the log indicates the exception is coming from com.apple.CoreAnalytics (see below). The exception is only thrown once. And, the exception is NOT thrown when I run the app on the simulator. Thanks in advance for your thoughts and ideas!
Sometimes Apple's frameworks use exceptions as an internal messaging technique. They probably shouldn't do that, but the frameworks contain a lot of old code that doesn't always follow best practices. There is no harm done, because the framework, having thrown the exception, also catches it, which is why you run fine if the app just runs without the debugger. But if you run from Xcode and you have set an Exception Breakpoint, you will pause after the throw but before the catch. It looks like that's what's happening. So just remove that breakpoint.

Intermittent Xamarin.iOS crash with no exception thrown

I have created a Xamarin.Forms barcode scanning app with Android and iOS projects. The Android build appears to run fine, but the iOS build occasionally crashes and I am struggling to pin down the cause, as no crash log is produced and no exception is reported in the application output.
Under heavy load (non-stop barcode scanning) the app crashes after typically 200 or 300 barcodes have been scanned.
I am puzzled how such a crash can occur, leaving absolutely no evidence of its cause. Is there somewhere else I should be looking for the evidence, apart from within Xcode's Devices window? Shouldn't I expect an exception to be reported in the application output, while debugging?
I have implemented logging handlers for AppDomain.CurrentDomain.UnhandledException and TaskScheduler.UnobservedTaskException but they don't appear to be called. Is there some other way I can instrument my code to trap the cause of this crash?
Many thanks for your advice,
Tim
To get some output I always hit the continue button in visual studio debugger. The application stops, and for some reason I can see an exception in the output. Hope this helps.

iOS Wikitude SDK crash on exit/reopen app

I've developed a simply app for iOS and Augmented Reality (with WikitudeSDK).
All go fine, but when I exit and reopen the app, at times the app crashes with the following message:
Assertion failure in -[WTGCDDriver createSharedContextWithId:], /Users/emperor/Development/Tools/Jenkins/Master/Instance/jobs/architect_sdk_builder/workspace/repositories/ios_core_services/src/Rendering/Driver/WTDriver.mm:71
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Invalid parameter not satisfying: _context'
Have you any idea of this?
Thanks.
For some reason the OpenGL context is null when you reopen your app; you receive this error because we seem to have forgotten to disable assertions for a public build. So thanks for making us aware of this oversight.
With respect to the actual issue, I cannot provide an answer without having more of an insight into what exactly your app is doing and which version and configuration of the SDK you are using.
I'd therefore like you to create a thread in the Wikitude forums which provides a platform that is better suited for assisting you with this issue than Stack Overflow is.

Objective-C exceptions and Flex mobile ANE

I am working on this ANE where I am having this issue whereby the #catch clause of the Objective-C code is not executed. The application just crash whenever an exception is thrown. Seems like exceptions in native code are not supported. I have also tried the to add the -fobjc-exceptions flag as an option to my ios-platformoptions.xml file but this resulted in an "ld: unknown option" error.
Could anybody confirm and/or perhaps post some Adobe documentation weather exceptions in native code are supported or not, or am I doing something wrong? How can I enforce and enable exceptions?

Resources