// // 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) { global::Xamarin.Forms.Forms.Init(); #if !__NATIVE_DEPENDENCIES_EXIST__ throw new System.Exception( "The requisite onnxruntime.framework file(s) were not found. " + "You must build the native iOS components before running this sample"); #else // Register default session options configuration. SessionOptionsContainer.Register((sessionOptions) => { sessionOptions.LogId = "Ort"; }); // Register a named session options configuration that enables the CoreML EP SessionOptionsContainer.Register("ort_with_npu", (sessionOptions) => { sessionOptions.AppendExecutionProvider_CoreML(CoreMLFlags.COREML_FLAG_ONLY_ENABLE_DEVICE_WITH_ANE); options.LogId = "Ort+CoreML"; }); LoadApplication(new App()); #endif #pragma warning disable CS0162 // Unreachable code detected return(base.FinishedLaunching(app, options)); #pragma warning restore CS0162 // Unreachable code detected }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); Xamarin.Essentials.Platform.Init(this, savedInstanceState); global::Xamarin.Forms.Forms.Init(this, savedInstanceState); // Register default session options configuration. This is optional. SessionOptionsContainer.Register((options) => { options.LogId = "Ort"; }); // Register a named session options configuration that enables NNAPI SessionOptionsContainer.Register("ort_with_npu", (options) => { options.AppendExecutionProvider_Nnapi(); options.LogId = "Ort+Nnapi"; }); LoadApplication(new App()); }