国产亚洲欧美人成在线,免费视频爱爱太爽了无码,日本免费一区二区三区高清视频 ,国产真实伦对白精彩视频

歡迎您光臨深圳塔燈網(wǎng)絡(luò)科技有限公司!
電話圖標(biāo) 余先生:13699882642

網(wǎng)站百科

為您解碼網(wǎng)站建設(shè)的點(diǎn)點(diǎn)滴滴

Flutter與iOS混編(pod)

發(fā)表日期:2018-11 文章編輯:小燈 瀏覽次數(shù):3875

一、配置過(guò)程

  • 1. 新建一個(gè)xcode工程:FlutterNativeFrame
    跟flutter在同級(jí)別路徑

    image.png

  • 2. binding flutter

// flutter_application_path:flutter工程的絕對(duì)路徑 flutter_application_path = '**/**/my_flutter' eval(File.read(File.join(flutter_application_path, '.ios', 'Flutter', 'podhelper.rb')), binding) 
image.png
  • 3.執(zhí)行pod install
    執(zhí)行完之后,打開(kāi)xcode工程,出現(xiàn)如圖所示的兩個(gè)文件夾,success

    image.png

  • 4. 添加腳本文件
    "$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh" build "$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh" embed

    image.png

image.png

ok,run,如果運(yùn)行報(bào)錯(cuò),把Enable Bitcode 設(shè)為NO,F(xiàn)lutter混合開(kāi)發(fā)還不支持bit code,所以在iOS工程檢查項(xiàng)目并關(guān)閉bit code

image.png

現(xiàn)在應(yīng)該可以運(yùn)行起來(lái)了,如果還是不行,重復(fù)以上步驟

混編開(kāi)始:
修改AppDelegate.h、AppDelegate.m

// .h #import <UIKit/UIKit.h> #import <Flutter/Flutter.h>@interface AppDelegate : FlutterAppDelegate @end// .m #import <FlutterPluginRegistrant/GeneratedPluginRegistrant.h> // Only if you have Flutter Plugins#include "AppDelegate.h"@implementation AppDelegate// This override can be omitted if you do not have any Flutter Plugins. - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { [GeneratedPluginRegistrant registerWithRegistry:self]; return [super application:application didFinishLaunchingWithOptions:launchOptions]; }@end 

ViewController跳轉(zhuǎn)

#import <Flutter/Flutter.h> #import "ViewController.h"@implementation ViewController - (void)viewDidLoad { [super viewDidLoad]; UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom]; [button addTarget:selfaction:@selector(handleButtonAction)forControlEvents:UIControlEventTouchUpInside]; [button setTitle:@"Press me" forState:UIControlStateNormal]; [button setBackgroundColor:[UIColor blueColor]]; button.frame = CGRectMake(80.0, 210.0, 160.0, 40.0); [self.view addSubview:button]; }- (void)handleButtonAction { FlutterViewController* flutterViewController = [[FlutterViewController alloc] init]; [self presentViewController:flutterViewController animated:false completion:nil]; } @end 

二、熱更新 Hot Reload

cd到flutter工程路徑,執(zhí)行flutter attach
attach成功之后,運(yùn)行xcode,更新直接press 'r'

image.png

在VStudio中修改dart文件,press 'r'直接可以看到修改之后的顯示

官網(wǎng)鏈接:Hot reload https://flutter.io/docs/development/tools/hot-reload


本頁(yè)內(nèi)容由塔燈網(wǎng)絡(luò)科技有限公司通過(guò)網(wǎng)絡(luò)收集編輯所得,所有資料僅供用戶學(xué)習(xí)參考,本站不擁有所有權(quán),如您認(rèn)為本網(wǎng)頁(yè)中由涉嫌抄襲的內(nèi)容,請(qǐng)及時(shí)與我們聯(lián)系,并提供相關(guān)證據(jù),工作人員會(huì)在5工作日內(nèi)聯(lián)系您,一經(jīng)查實(shí),本站立刻刪除侵權(quán)內(nèi)容。本文鏈接:http://m.jstctz.cn/17756.html
相關(guān)APP開(kāi)發(fā)