官术网_书友最值得收藏!

  • Xamarin Blueprints
  • Michael Williams
  • 186字
  • 2021-07-08 11:48:22

Setting up the SpeechTalk.iOS project

Let's also have a look at the project setup on the native side for iOS and Android. Open the AppDelegate.cs file; it should look like this:

    [Register ("AppDelegate")] 
    public partial class AppDelegate : global::Xamarin.Forms.Platform.iOS.FormsApplicationDelegate 
    { 
        public override bool FinishedLaunching (UIApplication app, NSDictionary options) 
        { 
            global::Xamarin.Forms.Forms.Init (); 
 
            LoadApplication (new App ()); 
 
            return base.FinishedLaunching (app, options); 
        } 
    } 

Have a look at the super class:

global::Xamarin.Forms.Platform.iOS.FormsApplicationDelegate 

Since Xamarin.Forms 1.3.1 and the updated unified API, all our app delegate should be inheriting is Xamarin.Forms.Platform.iOS.FormsApplicationDelegate. We also have the standard FinishedLaunching function; in here we must call Forms.Init which will initialize Xamarin.Forms, and then call LoadApplication with a new instantiation of the App class. We then return the base class FinishedLaunching function, passing in the app and options objects.

You can see that this FinishedLaunching function is an override of the standard app delegate function.

Note

We must initialize forms before anything else occurs in this function.

Let's run the iOS application and see what happens:

Fantastic, a blank application. That means we have now successfully run our first iOS Xamarin.Forms project.

主站蜘蛛池模板: 周至县| 杭锦后旗| 腾冲县| 吉水县| 泸溪县| 易门县| 宜宾市| 峨眉山市| 全州县| 溧阳市| 吉木萨尔县| 根河市| 柏乡县| 平利县| 呼玛县| 阿图什市| 高淳县| 自贡市| 长汀县| 措勤县| 南汇区| 麻城市| 浮山县| 潍坊市| 普洱| 临沂市| 泾川县| 富顺县| 阜平县| 沅江市| 佛山市| 海晏县| 肃北| 敦煌市| 安塞县| 潞城市| 涟水县| 常德市| 珠海市| 博兴县| 太和县|