Paul Sinnema
Paul Sinnema

Reputation: 2792

Xamarin Foundation.ModelNotImplementedException in PresentViewController

I keep getting a Foundation.ModelNotImplementedException when I'm trying to show an alert. I've downloaded an example from Xamarin and tried to find the differences but can't find any.

Here's the code from the AppDelegate.cs file:

using System;
using System.Collections.Generic;
using System.Linq;

using Foundation;
using UIKit;
using BOABackgroundService.Classes;
using Xamarin.Forms;

namespace BOABackgroundService.iOS
{
    // The UIApplicationDelegate for the application. This class is responsible for launching the 
    // User Interface of the application, as well as listening (and optionally responding) to 
    // application events from iOS.
    [Register("AppDelegate")]
    public partial class AppDelegate : global::Xamarin.Forms.Platform.iOS.FormsApplicationDelegate
    {
        //
        // This method is invoked when the application has loaded and is ready to run. In this 
        // method you should instantiate the window, load the UI into it and then make the window
        // visible.
        //
        // You have 17 seconds to return from this method, or iOS will terminate your application.
        //
        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            Forms.Init();

            InitNotifications(app, options);

            LoadApplication(new App());

            return base.FinishedLaunching(app, options);
        }

        private void InitNotifications(UIApplication app, NSDictionary options)
        {
            if (UIDevice.CurrentDevice.CheckSystemVersion(8, 0))
            {
                var settings = UIUserNotificationSettings.GetSettingsForTypes(
                UIUserNotificationType.Alert |
                UIUserNotificationType.Badge |
                UIUserNotificationType.Sound, null);
                app.RegisterUserNotificationSettings(settings);
            }

            if (UIDevice.CurrentDevice.CheckSystemVersion(10, 0))
            {
                // TODO: Notifications for 10.0 and higher
            }
            else
            {
                // check for a notification
                if (options != null)
                {
                    // check for a local notification
                    if (options.ContainsKey(UIApplication.LaunchOptionsLocalNotificationKey))
                    {
                        var localNotification = options[UIApplication.LaunchOptionsLocalNotificationKey] as UILocalNotification;
                        if (localNotification != null)
                        {
                            UIAlertController okayAlertController = UIAlertController.Create(localNotification.AlertAction, localNotification.AlertBody, UIAlertControllerStyle.Alert);
                            okayAlertController.AddAction(UIAlertAction.Create("OK", UIAlertActionStyle.Default, null));

                            Window.RootViewController.PresentViewController(okayAlertController, true, null);

                            // reset our badge
                            UIApplication.SharedApplication.ApplicationIconBadgeNumber = 0;
                        }
                    }
                }
            }
        }

        public override void ReceivedLocalNotification(UIApplication application, UILocalNotification notification)
        {
            if (UIDevice.CurrentDevice.CheckSystemVersion(10, 0))
            {
                // TODO: Notifications for 10.0 and higher
            }
            else
            {
                UIAlertController okayAlertController = UIAlertController.Create(notification.AlertAction, notification.AlertBody, UIAlertControllerStyle.Alert);
                okayAlertController.AddAction(UIAlertAction.Create("OK", UIAlertActionStyle.Default, null));

                // *** THIS IS WHERE THE EXCEPTION IS THROWN ***
                Window.RootViewController.PresentViewController(okayAlertController, true, null);

                UIApplication.SharedApplication.ApplicationIconBadgeNumber = 0;
            }
        }
    }
}

And here's the code that issues the Notification:

            public void Notification(string name, string text)
        {
            if (UIDevice.CurrentDevice.CheckSystemVersion(10, 0))
            {
                // TODO Notification voor 10.0 and higher.
            }
            else
            {
                UILocalNotification notification = new UILocalNotification();

                notification.FireDate = NSDate.Now;
                notification.AlertAction = "NatuurNetwerk";
                notification.AlertBody = text;
                // notification.ApplicationIconBadgeNumber = 1;
                notification.SoundName = UILocalNotification.DefaultSoundName;

                UIApplication.SharedApplication.ScheduleLocalNotification(notification);
            }
        }

There are some disturbing looking messages in the output window I can't make sense of:

InspectorDebugSession(10): StateChange: Start -> EntryPointBreakpointRegistered
InspectorDebugSession(10): Constructed
Launching 'BOABackgroundService.iOS' on 'iPhone 6 iOS 9.3'...
InspectorDebugSession(10): HandleTargetEvent: TargetReady
Loaded assembly: /Users/username/Library/Developer/CoreSimulator/Devices/BEC706BF-2E76-4269-B4E5-49A4AD84DBA6/data/Containers/Bundle/Application/13748412-CF6A-4D26-B8AD-A4B4605174E7/BOABackgroundService.iOS.app/.monotouch-64/Xamarin.iOS.dll [External]
Loaded assembly: /Users/username/Library/Developer/CoreSimulator/Devices/BEC706BF-2E76-4269-B4E5-49A4AD84DBA6/data/Containers/Bundle/Application/13748412-CF6A-4D26-B8AD-A4B4605174E7/BOABackgroundService.iOS.app/.monotouch-64/System.dll [External]
Resolved pending breakpoint for 'UIKit.UIApplication.Main(string[], string, string)' to /Users/builder/data/lanes/3985/35d1ccd0/source/xamarin-macios/src/UIKit/UIApplication.cs:61 [0x00000].
Resolved pending breakpoint for 'UIKit.UIApplication.Main(string[], System.Type, System.Type)' to /Users/builder/data/lanes/3985/35d1ccd0/source/xamarin-macios/src/UIKit/UIApplication.cs:68 [0x00000].
Resolved pending breakpoint for 'UIKit.UIApplication.Main(string[])' to /Users/builder/data/lanes/3985/35d1ccd0/source/xamarin-macios/src/UIKit/UIApplication.cs:73 [0x00000].
Resolved pending breakpoint for 'UIKit.UIApplication.Main(string[], System.IntPtr, System.IntPtr)' to /Users/builder/data/lanes/3985/35d1ccd0/source/xamarin-macios/src/UIKit/UIApplication.cs:78 [0x00000].
Thread started:  #2
InspectorDebugSession(10): HandleTargetEvent: ThreadStarted
Loaded assembly: /Users/username/Library/Developer/CoreSimulator/Devices/BEC706BF-2E76-4269-B4E5-49A4AD84DBA6/data/Containers/Bundle/Application/13748412-CF6A-4D26-B8AD-A4B4605174E7/BOABackgroundService.iOS.app/.monotouch-64/BOABackgroundService.iOS.exe
Loaded assembly: /Users/username/Library/Developer/CoreSimulator/Devices/BEC706BF-2E76-4269-B4E5-49A4AD84DBA6/data/Containers/Bundle/Application/13748412-CF6A-4D26-B8AD-A4B4605174E7/BOABackgroundService.iOS.app/.monotouch-64/Xamarin.Forms.Platform.iOS.dll [External]
Loaded assembly: /Users/username/Library/Developer/CoreSimulator/Devices/BEC706BF-2E76-4269-B4E5-49A4AD84DBA6/data/Containers/Bundle/Application/13748412-CF6A-4D26-B8AD-A4B4605174E7/BOABackgroundService.iOS.app/.monotouch-64/BOABackgroundService.dll
Loaded assembly: /Users/username/Library/Developer/CoreSimulator/Devices/BEC706BF-2E76-4269-B4E5-49A4AD84DBA6/data/Containers/Bundle/Application/13748412-CF6A-4D26-B8AD-A4B4605174E7/BOABackgroundService.iOS.app/.monotouch-64/Xamarin.Forms.Core.dll [External]
Loaded assembly: /Users/username/Library/Developer/CoreSimulator/Devices/BEC706BF-2E76-4269-B4E5-49A4AD84DBA6/data/Containers/Bundle/Application/13748412-CF6A-4D26-B8AD-A4B4605174E7/BOABackgroundService.iOS.app/.monotouch-64/System.Runtime.dll [External]
Loaded assembly: /Users/username/Library/Developer/CoreSimulator/Devices/BEC706BF-2E76-4269-B4E5-49A4AD84DBA6/data/Containers/Bundle/Application/13748412-CF6A-4D26-B8AD-A4B4605174E7/BOABackgroundService.iOS.app/.monotouch-64/System.ObjectModel.dll [External]
Loaded assembly: /Users/username/Library/Developer/CoreSimulator/Devices/BEC706BF-2E76-4269-B4E5-49A4AD84DBA6/data/Containers/Bundle/Application/13748412-CF6A-4D26-B8AD-A4B4605174E7/BOABackgroundService.iOS.app/.monotouch-64/System.Core.dll [External]
Loaded assembly: /Users/username/Library/Developer/CoreSimulator/Devices/BEC706BF-2E76-4269-B4E5-49A4AD84DBA6/data/Containers/Bundle/Application/13748412-CF6A-4D26-B8AD-A4B4605174E7/BOABackgroundService.iOS.app/.monotouch-64/System.Xml.dll [External]
Loaded assembly: /Users/username/Library/Developer/CoreSimulator/Devices/BEC706BF-2E76-4269-B4E5-49A4AD84DBA6/data/Containers/Bundle/Application/13748412-CF6A-4D26-B8AD-A4B4605174E7/BOABackgroundService.iOS.app/.monotouch-64/Mono.Dynamic.Interpreter.dll [External]
Loaded assembly: /Users/username/Library/Developer/CoreSimulator/Devices/BEC706BF-2E76-4269-B4E5-49A4AD84DBA6/data/Containers/Bundle/Application/13748412-CF6A-4D26-B8AD-A4B4605174E7/BOABackgroundService.iOS.app/.monotouch-64/System.ComponentModel.Composition.dll [External]
Loaded assembly: /Users/username/Library/Developer/CoreSimulator/Devices/BEC706BF-2E76-4269-B4E5-49A4AD84DBA6/data/Containers/Bundle/Application/13748412-CF6A-4D26-B8AD-A4B4605174E7/BOABackgroundService.iOS.app/.monotouch-64/System.Collections.dll [External]
Loaded assembly: /Users/username/Library/Developer/CoreSimulator/Devices/BEC706BF-2E76-4269-B4E5-49A4AD84DBA6/data/Containers/Bundle/Application/13748412-CF6A-4D26-B8AD-A4B4605174E7/BOABackgroundService.iOS.app/.monotouch-64/System.Diagnostics.Debug.dll [External]
Loaded assembly: /Users/username/Library/Developer/CoreSimulator/Devices/BEC706BF-2E76-4269-B4E5-49A4AD84DBA6/data/Containers/Bundle/Application/13748412-CF6A-4D26-B8AD-A4B4605174E7/BOABackgroundService.iOS.app/.monotouch-64/System.Threading.Tasks.dll [External]
Loaded assembly: /Users/username/Library/Developer/CoreSimulator/Devices/BEC706BF-2E76-4269-B4E5-49A4AD84DBA6/data/Containers/Bundle/Application/13748412-CF6A-4D26-B8AD-A4B4605174E7/BOABackgroundService.iOS.app/.monotouch-64/System.Globalization.dll [External]
Loaded assembly: /Users/username/Library/Developer/CoreSimulator/Devices/BEC706BF-2E76-4269-B4E5-49A4AD84DBA6/data/Containers/Bundle/Application/13748412-CF6A-4D26-B8AD-A4B4605174E7/BOABackgroundService.iOS.app/.monotouch-64/System.ComponentModel.dll [External]
Loaded assembly: /Users/username/Library/Developer/CoreSimulator/Devices/BEC706BF-2E76-4269-B4E5-49A4AD84DBA6/data/Containers/Bundle/Application/13748412-CF6A-4D26-B8AD-A4B4605174E7/BOABackgroundService.iOS.app/.monotouch-64/System.Xml.ReaderWriter.dll [External]
Loaded assembly: /Users/username/Library/Developer/CoreSimulator/Devices/BEC706BF-2E76-4269-B4E5-49A4AD84DBA6/data/Containers/Bundle/Application/13748412-CF6A-4D26-B8AD-A4B4605174E7/BOABackgroundService.iOS.app/.monotouch-64/System.Reflection.dll [External]
Loaded assembly: /Users/username/Library/Developer/CoreSimulator/Devices/BEC706BF-2E76-4269-B4E5-49A4AD84DBA6/data/Containers/Bundle/Application/13748412-CF6A-4D26-B8AD-A4B4605174E7/BOABackgroundService.iOS.app/.monotouch-64/System.Linq.Expressions.dll [External]
Loaded assembly: /Users/username/Library/Developer/CoreSimulator/Devices/BEC706BF-2E76-4269-B4E5-49A4AD84DBA6/data/Containers/Bundle/Application/13748412-CF6A-4D26-B8AD-A4B4605174E7/BOABackgroundService.iOS.app/.monotouch-64/System.IO.dll [External]
Loaded assembly: /Users/username/Library/Developer/CoreSimulator/Devices/BEC706BF-2E76-4269-B4E5-49A4AD84DBA6/data/Containers/Bundle/Application/13748412-CF6A-4D26-B8AD-A4B4605174E7/BOABackgroundService.iOS.app/.monotouch-64/System.Dynamic.Runtime.dll [External]
Loaded assembly: /Users/username/Library/Developer/CoreSimulator/Devices/BEC706BF-2E76-4269-B4E5-49A4AD84DBA6/data/Containers/Bundle/Application/13748412-CF6A-4D26-B8AD-A4B4605174E7/BOABackgroundService.iOS.app/.monotouch-64/System.Threading.dll [External]
Loaded assembly: /Users/username/Library/Developer/CoreSimulator/Devices/BEC706BF-2E76-4269-B4E5-49A4AD84DBA6/data/Containers/Bundle/Application/13748412-CF6A-4D26-B8AD-A4B4605174E7/BOABackgroundService.iOS.app/.monotouch-64/Xamarin.Forms.Platform.dll [External]
Loaded assembly: /Users/username/Library/Developer/CoreSimulator/Devices/BEC706BF-2E76-4269-B4E5-49A4AD84DBA6/data/Containers/Bundle/Application/13748412-CF6A-4D26-B8AD-A4B4605174E7/BOABackgroundService.iOS.app/.monotouch-64/System.Net.Http.dll [External]
Loaded assembly: /Users/username/Library/Developer/CoreSimulator/Devices/BEC706BF-2E76-4269-B4E5-49A4AD84DBA6/data/Containers/Bundle/Application/13748412-CF6A-4D26-B8AD-A4B4605174E7/BOABackgroundService.iOS.app/.monotouch-64/System.Runtime.Serialization.dll [External]
Loaded assembly: /Users/username/Library/Developer/CoreSimulator/Devices/BEC706BF-2E76-4269-B4E5-49A4AD84DBA6/data/Containers/Bundle/Application/13748412-CF6A-4D26-B8AD-A4B4605174E7/BOABackgroundService.iOS.app/.monotouch-64/System.ServiceModel.Internals.dll [External]
Loaded assembly: /Users/username/Library/Developer/CoreSimulator/Devices/BEC706BF-2E76-4269-B4E5-49A4AD84DBA6/data/Containers/Bundle/Application/13748412-CF6A-4D26-B8AD-A4B4605174E7/BOABackgroundService.iOS.app/.monotouch-64/System.Runtime.Extensions.dll [External]
Loaded assembly: /Users/username/Library/Developer/CoreSimulator/Devices/BEC706BF-2E76-4269-B4E5-49A4AD84DBA6/data/Containers/Bundle/Application/13748412-CF6A-4D26-B8AD-A4B4605174E7/BOABackgroundService.iOS.app/.monotouch-64/System.Linq.dll [External]
Loaded assembly: /Users/username/Library/Developer/CoreSimulator/Devices/BEC706BF-2E76-4269-B4E5-49A4AD84DBA6/data/Containers/Bundle/Application/13748412-CF6A-4D26-B8AD-A4B4605174E7/BOABackgroundService.iOS.app/.monotouch-64/System.Reflection.Extensions.dll [External]
Loaded assembly: /Users/username/Library/Developer/CoreSimulator/Devices/BEC706BF-2E76-4269-B4E5-49A4AD84DBA6/data/Containers/Bundle/Application/13748412-CF6A-4D26-B8AD-A4B4605174E7/BOABackgroundService.iOS.app/.monotouch-64/System.Resources.ResourceManager.dll [External]
Loaded assembly: /Users/username/Library/Developer/CoreSimulator/Devices/BEC706BF-2E76-4269-B4E5-49A4AD84DBA6/data/Containers/Bundle/Application/13748412-CF6A-4D26-B8AD-A4B4605174E7/BOABackgroundService.iOS.app/.monotouch-64/System.Diagnostics.Tools.dll [External]
Loaded assembly: /Users/username/Library/Developer/CoreSimulator/Devices/BEC706BF-2E76-4269-B4E5-49A4AD84DBA6/data/Containers/Bundle/Application/13748412-CF6A-4D26-B8AD-A4B4605174E7/BOABackgroundService.iOS.app/.monotouch-64/Microsoft.AspNet.SignalR.Client.dll [External]
2017-02-24 16:17:57.572 BOABackgroundService.iOS[19278:262973] Could not find `Newtonsoft.Json` referenced by assembly `Microsoft.AspNet.SignalR.Client, Version=2.0.0.0, Culture=neutral, PublicKeyToken=4704e1264c0eb6e1`.
Loaded assembly: /Users/username/Library/Developer/CoreSimulator/Devices/BEC706BF-2E76-4269-B4E5-49A4AD84DBA6/data/Containers/Bundle/Application/13748412-CF6A-4D26-B8AD-A4B4605174E7/BOABackgroundService.iOS.app/.monotouch-64/System.Net.Http.Extensions.dll [External]
Loaded assembly: /Users/username/Library/Developer/CoreSimulator/Devices/BEC706BF-2E76-4269-B4E5-49A4AD84DBA6/data/Containers/Bundle/Application/13748412-CF6A-4D26-B8AD-A4B4605174E7/BOABackgroundService.iOS.app/.monotouch-64/Xamarin.Forms.Xaml.dll [External]
Loaded assembly: /Users/username/Library/Developer/CoreSimulator/Devices/BEC706BF-2E76-4269-B4E5-49A4AD84DBA6/data/Containers/Bundle/Application/13748412-CF6A-4D26-B8AD-A4B4605174E7/BOABackgroundService.iOS.app/.monotouch-64/System.Text.RegularExpressions.dll [External]
Loaded assembly: /Users/username/Library/Developer/CoreSimulator/Devices/BEC706BF-2E76-4269-B4E5-49A4AD84DBA6/data/Containers/Bundle/Application/13748412-CF6A-4D26-B8AD-A4B4605174E7/BOABackgroundService.iOS.app/.monotouch-64/Plugin.DeviceInfo.dll [External]
Loaded assembly: /Users/username/Library/Developer/CoreSimulator/Devices/BEC706BF-2E76-4269-B4E5-49A4AD84DBA6/data/Containers/Bundle/Application/13748412-CF6A-4D26-B8AD-A4B4605174E7/BOABackgroundService.iOS.app/.monotouch-64/Plugin.DeviceInfo.Abstractions.dll [External]
InspectorDebugSession(10): HandleTargetEvent: TargetHitBreakpoint
InspectorDebugSession(10): StateChange: EntryPointBreakpointRegistered -> EntryPointBreakpointHit
InspectorDebugSession(10): AgentBridge.InjectAssembly: /Library/Frameworks/Xamarin.Interactive.framework/Versions/Current/Agents/iOS/Xamarin.Interactive.iOS.dll
InspectorDebugSession(10): StateChange: EntryPointBreakpointHit -> BreakdanceInvoking
Loaded assembly: /Library/Frameworks/Xamarin.Interactive.framework/Versions/Current/Agents/iOS/Xamarin.Interactive.iOS.dll [External]
Loaded assembly: /Library/Frameworks/Xamarin.Interactive.framework/Versions/Current/Agents/iOS/Xamarin.Interactive.dll [External]
InspectorDebugSession(10): StateChange: BreakdanceInvoking -> BreakdanceStarted
Thread started: <Thread Pool> #4
InspectorDebugSession(10): HandleTargetEvent: ThreadStarted
Thread started: <Thread Pool> #5
InspectorDebugSession(10): HandleTargetEvent: ThreadStarted
Thread started: <Thread Pool> #6
InspectorDebugSession(10): HandleTargetEvent: ThreadStarted
2017-02-24 16:18:00.261 BOABackgroundService.iOS[19278:262973] Error loading /System/Library/Extensions/IOHIDFamily.kext/Contents/PlugIns/IOHIDLib.plugin/Contents/MacOS/IOHIDLib:  dlopen(/System/Library/Extensions/IOHIDFamily.kext/Contents/PlugIns/IOHIDLib.plugin/Contents/MacOS/IOHIDLib, 262): no suitable image found.  Did find:
    /System/Library/Extensions/IOHIDFamily.kext/Contents/PlugIns/IOHIDLib.plugin/Contents/MacOS/IOHIDLib: mach-o, but not built for iOS simulator
2017-02-24 16:18:00.262 BOABackgroundService.iOS[19278:262973] Cannot find function pointer IOHIDLibFactory for factory 13AA9C44-6F1B-11D4-907C-0005028F18D5 in CFBundle/CFPlugIn 0x7fb09790bb40 </System/Library/Extensions/IOHIDFamily.kext/Contents/PlugIns/IOHIDLib.plugin> (bundle, not loaded)
2017-02-24 16:18:00.263 BOABackgroundService.iOS[19278:262973] Error loading /System/Library/Extensions/IOHIDFamily.kext/Contents/PlugIns/IOHIDLib.plugin/Contents/MacOS/IOHIDLib:  dlopen(/System/Library/Extensions/IOHIDFamily.kext/Contents/PlugIns/IOHIDLib.plugin/Contents/MacOS/IOHIDLib, 262): no suitable image found.  Did find:
    /System/Library/Extensions/IOHIDFamily.kext/Contents/PlugIns/IOHIDLib.plugin/Contents/MacOS/IOHIDLib: mach-o, but not built for iOS simulator
2017-02-24 16:18:00.263 BOABackgroundService.iOS[19278:262973] Cannot find function pointer IOHIDLibFactory for factory 13AA9C44-6F1B-11D4-907C-0005028F18D5 in CFBundle/CFPlugIn 0x7fb09790bb40 </System/Library/Extensions/IOHIDFamily.kext/Contents/PlugIns/IOHIDLib.plugin> (bundle, not loaded)
2017-02-24 16:18:00.264 BOABackgroundService.iOS[19278:262973] Error loading /System/Library/Extensions/IOHIDFamily.kext/Contents/PlugIns/IOHIDLib.plugin/Contents/MacOS/IOHIDLib:  dlopen(/System/Library/Extensions/IOHIDFamily.kext/Contents/PlugIns/IOHIDLib.plugin/Contents/MacOS/IOHIDLib, 262): no suitable image found.  Did find:
    /System/Library/Extensions/IOHIDFamily.kext/Contents/PlugIns/IOHIDLib.plugin/Contents/MacOS/IOHIDLib: mach-o, but not built for iOS simulator
2017-02-24 16:18:00.264 BOABackgroundService.iOS[19278:262973] Cannot find function pointer IOHIDLibFactory for factory 13AA9C44-6F1B-11D4-907C-0005028F18D5 in CFBundle/CFPlugIn 0x7fb09790bb40 </System/Library/Extensions/IOHIDFamily.kext/Contents/PlugIns/IOHIDLib.plugin> (bundle, not loaded)
2017-02-24 16:18:00.265 BOABackgroundService.iOS[19278:262973] Error loading /System/Library/Extensions/IOHIDFamily.kext/Contents/PlugIns/IOHIDLib.plugin/Contents/MacOS/IOHIDLib:  dlopen(/System/Library/Extensions/IOHIDFamily.kext/Contents/PlugIns/IOHIDLib.plugin/Contents/MacOS/IOHIDLib, 262): no suitable image found.  Did find:
    /System/Library/Extensions/IOHIDFamily.kext/Contents/PlugIns/IOHIDLib.plugin/Contents/MacOS/IOHIDLib: mach-o, but not built for iOS simulator
2017-02-24 16:18:00.265 BOABackgroundService.iOS[19278:262973] Cannot find function pointer IOHIDLibFactory for factory 13AA9C44-6F1B-11D4-907C-0005028F18D5 in CFBundle/CFPlugIn 0x7fb09790bb40 </System/Library/Extensions/IOHIDFamily.kext/Contents/PlugIns/IOHIDLib.plugin> (bundle, not loaded)
2017-02-24 16:18:00.266 BOABackgroundService.iOS[19278:262973] Error loading /System/Library/Extensions/IOHIDFamily.kext/Contents/PlugIns/IOHIDLib.plugin/Contents/MacOS/IOHIDLib:  dlopen(/System/Library/Extensions/IOHIDFamily.kext/Contents/PlugIns/IOHIDLib.plugin/Contents/MacOS/IOHIDLib, 262): no suitable image found.  Did find:
    /System/Library/Extensions/IOHIDFamily.kext/Contents/PlugIns/IOHIDLib.plugin/Contents/MacOS/IOHIDLib: mach-o, but not built for iOS simulator
2017-02-24 16:18:00.266 BOABackgroundService.iOS[19278:262973] Cannot find function pointer IOHIDLibFactory for factory 13AA9C44-6F1B-11D4-907C-0005028F18D5 in CFBundle/CFPlugIn 0x7fb09790bb40 </System/Library/Extensions/IOHIDFamily.kext/Contents/PlugIns/IOHIDLib.plugin> (bundle, not loaded)
InspectorDebugSession(10): HandleTargetEvent: UnhandledException
Unhandled Exception:

Foundation.ModelNotImplementedException: Exception of type 'Foundation.ModelNotImplementedException' was thrown.

Thread finished: <Thread Pool> #6
InspectorDebugSession(10): HandleTargetEvent: ThreadStopped
Thread finished: <Thread Pool> #5
InspectorDebugSession(10): HandleTargetEvent: ThreadStopped
The thread 'Unknown' (0x6) has exited with code 0 (0x0).
The thread 'Unknown' (0x5) has exited with code 0 (0x0).
Thread finished: <Thread Pool> #4
InspectorDebugSession(10): HandleTargetEvent: ThreadStopped
The thread 'Unknown' (0x4) has exited with code 0 (0x0).

Upvotes: 1

Views: 546

Answers (1)

Paul Sinnema
Paul Sinnema

Reputation: 2792

I had to add the following code to solve this problem. Really strange that this is not documented at Xamarin somewhere.

public override UIWindow Window { get; set; }

public override bool FinishedLaunching(UIApplication app, NSDictionary options)
    {
        Window = new UIWindow(UIScreen.MainScreen.Bounds);
        Window.RootViewController = new UIViewController();
        Window.MakeKeyAndVisible();

        Forms.Init();

        InitNotifications(app, options);

        LoadApplication(new App());

        return base.FinishedLaunching(app, options);
    }

Upvotes: 1

Related Questions