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

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.

主站蜘蛛池模板: 玛沁县| 辽阳市| 车险| 武鸣县| 岑巩县| 凤翔县| 桂平市| 汶上县| 卢氏县| 鹿邑县| 海门市| 太和县| 安图县| 敦煌市| 阳江市| 扎赉特旗| 伊春市| 元江| 九龙县| 南京市| 杂多县| 宜昌市| 高陵县| 浏阳市| 饶阳县| 奉节县| 祁门县| 沿河| 富顺县| 东安县| 桃园县| 喀喇沁旗| 电白县| 措勤县| 清流县| 巨野县| 鹤庆县| 河北省| 铜山县| 乌兰察布市| 江永县|