Unable to build for Xamarin iOS

Hello there!
I have a custom application that’s being written in Xamarin. We don’t use Unity.
I am struggling to find out how to build for iOS. I have Android working fine, Xamarin.Android and Xamarin.Andorid.Bindings are all set up and no problem.
I cannot for the life of me figure out how I’m supposed to get this working for iOS. I tried following the MS instructions on linking Native Libraries but after using Sharpie all I get is a bunch of errors in the generated file (over 886)
I tried using the existing C# bindings from the Win32 API (which I use succesfully for the Android project) and this fails to compile with linker errors along this line:

MTOUCH : error MT5210: Native linking failed, undefined symbol: _FMOD_Studio_CommandReplay_GetCommandString. Please verify that all the necessary frameworks have been referenced and native libraries are properly linked in.

I have tried setting the Linker Behaviour to “Link All” and this has had no effect.

Any advice would be appreciated.

Thanks,
Dan

I’ve managed to finally figure this out.

Following the written instructions appears to have been the wrong approach. There was a video on the Xamarin walkthrough page from which I figured out the right way.

To make it work I did the following;

  1. Do not create a Xamarin binding project.
  2. Reference the static (*.a) libraries you need directly in your iOS application
  3. Set the library build actions to BundleResource
  4. You will need to specify your own mtouch arguments. Mine were:

-cxx -gcc_flags “-L${ProjectDir} -framework AudioToolbox -framework CoreAudio -force_load ${ProjectDir}/libfmod_iphoneos.a -force_load ${ProjectDir}/libfmodstudio_iphoneos.a”
The important parts here are that you must also include the framework options because these are seemingly not automagically detected by Mono.

With that done it should be working. Hope someone finds this helpful in the future

2 Likes