This error has been a show stopper for most anyone attempting to get GOOD Dynamics working with Xamarin. Fortunately, the fix is fairly straightforward. The issue results from the binding hiding the inheritance between GDiOSDelegate and UIApplicationDelegate. We know it’s implemented behind the scenes in Good, so we can safely tell the runtime that it is indeed implemented:

After the application is able to detect that inheritance, it begins to call methods that GOOD has implemented behind the scenes to intercept the application lifecycle. Calls to “application:didFinishLaunchingwithOptions:” have been modified to include a “gd” preface. These methods MUST be accounted for inside of your AppDelegate class. The full list can be found below:

The next setting that needs to be set is we need to tell Xamarin that this is a C++ library. To do this, under your iOS project settings (not the binding project), navigate to the iOS Build section. Under “Additional Monotouch Arguments” add the flag –cxx.

Up until v1.8.x of the GOOD Dynamics SDK, this would have been enough to get GOOD Dynamics running under Xamarin. However, with the release of v1.8.x, a new process has been added as a requirement to the compilation process. This process is known as FIPS Linking. Any application that does not undergo this process will crash on start. There are a few things that need to be done to your application in order to support this process.

First, navigate to your GOOD Dynamics SDK install directory, specifically the FIPS_module folder. This should be located here: “/Good Technology/GOOD.platform/FIPS_module/”. Inside of this directory you should find a folder for each system architecture iOS supports. In each one of these folders you’re going to need to make the following changes to account for differences between the XCode and Xamarin compilation processes. Inside of each bin folder (for each architecture) you should find a file called “gd_fipsld”. Copy this file and rename it to “ld”.

Once this is done, go back to your Xamarin.iOS project settings and navigate to the iOS Build section (where we added the –cxx flag before). We’re going to instruct Xamarin studio to use this new linker during its compilation process using an undocumented gcc_flag. First, make sure that you set Linker Behavior to “Link All Assemblies”. Next, add this after the –cxx flag:

Lastly, make sure that, in your GD.LinkWith.cs file in your binding project, “ForceLoad = true” is not present. Be sure to set the architecture version to your target compilation (e.g. armv7s.sdk, i386.sdk, etc.).

After all this.. you should now have a successfully bound and running application using the Good Dynamics SDK with Xamarin.iOS!

UPDATE:
In order to get this to run in the simulator, there are two additional steps that need to be accounted for. In the i386 version of the linker, add this line just after the modification for “iphoneos_version_min”:

After that, another additional monotouch argument needs to be provided. This argument is:

--registrar:static

Our mobility consulting professionals have extensive experience developing enterprise and consumer mobile apps using Xamarin on the Apple iOS, Android, and Windows Phone platforms. We’ve built numerous apps utilizing Good Dynamics. Contact us for more information on how we can work with you to build highly secure, cross-platform mobile applications.