Objective-C exceptions and Flex mobile ANE - ios

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?

Related

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.

Always stop in App delegate after enabling All C++ exceptions break point

I am always getting stuck in App Delegate class when enabling "All C++ exceptions" & "All exceptions". I tried with enabling "All Objective-C exceptions", it's working fine.
I am not getting any message in (lldb) pane.
Getting stuck here:
With exception enable:
I have followed below links:
Always stop in App delegate after enabling All exceptions break point
Xcode throws an exception in Main() in iOS 8 with 'all exceptions' breakpoint
Always trigger the all exceptions break point
As per the above link, I am not using any external font in my project.
Could you please help me why the app is always stuck in App Delegate?
Thanks in advance.

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

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.

Running Haxe from iOS app – hxRunLibrary() error

For a client I've developed an iOS + Android app using Cordova (PhoneGap) for the user interface. Now, as an update to this app, I'm am attempting to add a game that was written in Haxe. Originally the game was written for the Flash target, but I've updated it to work with the C++ targets for Android and iOS.
On Android it was easy to integrate this with the Cordova app using activities (the Haxe part runs as a separate activity), but I am having some trouble achieving a similar result on iOS.
So far I have tried to include all hxcpp generated code in my project (in the same way that NME sets up the XCode project when you do "nme build ios"), and I'm calling hxRunLibrary() from my code when I want the game to run.
The problem is that hxRunLibrary() seems to want to create its own UIApplication instance, which fails with the following error, since my main app is already running an instance:
*** Assertion failure in void UIApplicationInstantiateSingleton(Class)(), /SourceCache/UIKit_Sim/UIKit-2380.17/UIApplication.m:2037
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'There can only be one UIApplication instance.'
I think it might have something to do with SDL, which Haxe uses for graphics. From what I understand SDL needs to run from the main function of the app, which created a conflict with Cocoa that also needs to run from the main function.
Is there any easy way around this? I've looked in the hxcpp sources, but been unable to find the UIApplication related code, or any entry code for SDL.
Perhaps someone could point me in the right direction. Thanks!
Well ,I have googled some information about Haxe . what i understood is that The Haxe will prouduce a completed application for you .that mean it include the main Function . That's why the error is happend .
And you can simulate the problem by invoke UIApplicationMain Function twice .
In my opinion , you have to remove the code about UIApplicationMain from the souce code file produced by Haxe.
cordova has the ability to be integrated as part of a bigger application
ran into the same issue.
http://devgirl.org/2012/11/15/embed-cordovaphonegap-in-your-native-ios-app/
this article will help
you dont actually create a new project instead you embed it in a webview via the ios webview and cordova acts a subview.

Monotouch crash on GetCurrentProcess()

When my app calls System.Diagnostics.Process.GetCurrentProcess(), it throws this error and crashes my app:
Unregistered icall ‘System.Diagnostics.Process:GetPid_internal()’
Is there a fix for this?
System.Diagnostics.Process.GetCurrentProcess is not supported in MonoTouch, it should probably not have been available in the first place.
The fix is to not call Process.GetCurrentProcess (or even better: not use the Process class at all).

Resources