Forum Xamarin.iOS
We are excited to announce that the Xamarin Forums are moving to the new Microsoft Q&A experience. Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

We encourage you to head over to Microsoft Q&A for .NET for posting new questions and get involved today.

[Solved] Xamarin.Mac: error MM5109 in release build related to IKImageBrowserDataSource

intvsteveintvsteve USMember ✭✭
edited May 2017 in Xamarin.iOS

With some extremely valuable help, some time back I moved a solution that has 9 projects - over half of which were using MonoMac - to Xamarin.Mac. "Real Life" got in the way for a bit, so now, almost 8 months later, I picked it back up.

The debug build of the application builds and seems to run just fine. However, the release build fails. Here's the important part:

            /Users/steveno/Projects/locutus/lui_src/Locutus/LtoFlash/obj/Release/XamMac/mmp-cache/registrar.m:42620:64: error: no type or protocol named 'IKImageBrowserDataSource'
            /Users/steveno/Projects/locutus/lui_src/Locutus/LtoFlash/obj/Release/XamMac/mmp-cache/registrar.m:43597:91: error: unknown class name 'IKImageBrowserItem'; did you mean 'IKImageBrowserView'?
            /Applications/ note: 'IKImageBrowserView' declared here
            /Users/steveno/Projects/locutus/lui_src/Locutus/LtoFlash/obj/Release/XamMac/mmp-cache/registrar.m:43597:91: error: type argument 'IKImageBrowserView' must be a pointer (requires a '*')
            /Users/steveno/Projects/locutus/lui_src/Locutus/LtoFlash/obj/Release/XamMac/mmp-cache/registrar.m:43597:82: error: type arguments cannot be applied to non-parameterized class 'NSObject'

    MMP: error MM5109: Native linking failed with error code 1.  Check build log for details.

The class that implements IKImageBrowserDataSource is in a separate assembly, and is a private implementation class nested within a public class. I've tried moving the class out as a separate public entity, but it does not seem to make a difference.

Still need to work through the other two posts I found about this error to see if there's a common way to fix this. Looking at the mml-cache directories, it would seem the trouble lies with the registrar.m / registrar.h somewhere?

Also: I have not yet tried to load and build in Visual Studio for Mac - this is using the most recent Xamarin Studio Community and latest updates to Xcode, macOS Sierra, et. al.



  • intvsteveintvsteve USMember ✭✭
    edited May 2017

    @ChrisHamons to the rescue again! Looking over the release notes, it seems that they have a slight error.

    I got my build to work by adding this to 'Additional map arguments':


    The release notes mention using --registrar=default but I suspect that, since the default for release builds changed to static that it would not help if you needed to change the behavior. ;)

    Chris' blog post does tell you to use --registrar=dynamic :)

  • ChrisHamonsChrisHamons USForum Administrator, Xamarin Team Xamurai

    Good catch. I've updated the release notes (will take a bit to refresh in production).

  • ChrisHamonsChrisHamons USForum Administrator, Xamarin Team Xamurai

    Could you please consider filing a bug with the relevant C# attached? In theory "it should just work" :)

  • intvsteveintvsteve USMember ✭✭

    I'll pull changes over to GitHub, then file.

  • intvsteveintvsteve USMember ✭✭
    edited June 2017

    A new wrinkle here...

    It turns out that what I had were a pair of "dead code" classes. One subclassed IKImageBrowserDataSource, the other subclassed IKImageBrowserItem. Most likely these are from an abandoned feature -- or one that was somewhat-pseudo-coded and never finished. (The classes throw NotImplemented for all their methods.)

    Neither of these types were ever instantiated anywhere in the program!

    Once I excluded the code for these types from the release build, it succeeded, even with --registrar=static.

    This was with Xamarin Studio using xbuild. I could reproduce the linker error in VS.Mac, too -- so I fully expect the same result when building there, too.

    The moral of the story is: Don't have classes you don't use?


  • ThomasFlemmingThomasFlemming DEMember ✭✭

    Thanks for this, just run into the same issue.
    Adding --registrar=dynamic keeps me going on :)

Sign In or Register to comment.