Error: "_OBJC_CLASS_$_MKMapView", referenced from:

I was following this tutorial https://www.fusetools.com/docs/native-interop/native-ux-components to build native slider.

Here is the repo: https://github.com/poul-kg/NativeSlider

I was able to see native slider in iOS.

Then I decided to change slider to MapKit map, and see if it will work.

Below is partial example, I’ve added just 2 lines which alloc/init UIView and MKMapView, and this was enough to break the build

[Require("Source.Include", "UIKit/UIKit.h")]
    [Require("Source.Include", "MapKit/MapKit.h")]
    extern(iOS) public class MySlider: LeafView, ISlider
    {
        [UXConstructor]
        public MySlider([UXParameter("Host")]ISliderHost host) : base(Create()) { }

        [Foreign(Language.ObjC)]
        static ObjC.Object Create()
        @{
            ::UISlider* slider = [[::UISlider alloc] init];
            [slider setMinimumValue:   0.0f];
            [slider setMaximumValue: 100.0f];

            // I've added these 2 lines, and it breaks my build. Why?
            UIView *mvc = [[UIView alloc] init];
            MKMapView* mv = [[MKMapView alloc] init];

            // return
            return slider;
        @}

Error Message

For now fixed by following first answer on StackOverflow: https://stackoverflow.com/questions/19585317/when-added-mapkit-mapkit-h-getting-error-undefined-symbols-for-architecture-i

I wonder if there are any better way of adding required framework rather than doing it manually via XCode?

Hi Poul,

Sounds like [Require("Xcode.Framework", "yourframeworkname.framework")] would help here. Check out https://www.fusetools.com/docs/native-interop/build-settings#xcode-settings for some info on this and other useful attributes.

Thanks Chris,

I solved missing CoreLocation.framework by adding "Fuse.GeoLocation" to my .unoproj file.
now CoreLocation is available.

but this doesn’t work with [extern(iOS) Require("Xcode.EmbeddedFramework", "@('iOS/frameworks/Mapbox.framework':Path)")]

  • I see Mapbox.framework in Xcode in Embedded Frameworks section but I can not build my project without above error. So I add framework manually every time.

I need to manually add Mapbox.framework and select options below:

repo is here: https://github.com/poul-kg/NativeSlider/tree/map-box

To be honest, given that mapbox is in cocoapods, I’d probably just use that.
You can add a cocoapod dependency to your project with an attribute.

[Require("Cocoapods.Podfile.Target", "pod 'RMStore', '~> 0.7'")]

So for mapbox this should do the job:

[Require("Cocoapods.Podfile.Target", "pod 'Mapbox-iOS-SDK'")]

Of course you will need to install cocoapods first and then build your Fuse project with cocoapod support fuse build -tiOS -DCOCOAPODS (do an uno clean first)

Your first build with cocoapods will be super slow, as in maybe 15 minutes slow, this is cocoapods not fuse. After that the builds will be back to the usual speed.

I hope this helps