flutter:0.5.1首先,在你的專案裡面拖入xcode 9.4.1
flutter工程:flutter/examples/hello_world
flutter.framework
,這個庫是 flutter engine,承載了 dart執行時和繪圖引擎。flutter.framework
和命令列工具版本是一一對應的,如果你不知道從**找這個檔案,可以直接在 flutter原始碼專案裡面進行一次flutter run
,然後你就能在//ios/flutter/
目錄下面找到了,直接拖進專案即可。
接下來需要把 flutter的基礎**引入現有工程,有了基礎的 flutter viewcontroller才可以顯示 flutter檢視。這一步很簡單,只需要在你現有的 viewcontroller中 push過去就可以了:
- (void)jumptoflutter@inte***ce
/**flutterbinarymessenger
this determines which view controller is the flutter view controller
nomally, flutter view controller provides the binary messages
@return root flutter viewcontroller
*/- (nsobject
*)binarymessenger;
/**fluttertextureregistry
this determines which view controller is the flutter view controller
nomally, flutter view controller provides the custom textures
@return root flutter viewcontroller
*/- (nsobject
*)textures;
@end
然後在實現中支援 flutter messenger 和 texture
// registrar 宣告和實現這樣 flutter的執行環境其實就準備好了,無論是 hot restart還是 aot都可以支援。接下來我們實現 debug hot restart@inte***ce
@property(nonatomic, copy) nsstring *pluginkey;
@end
@implementation
self = [super init];
nsassert(self, @"super init cannot be nil");
_pluginkey = [pluginkey copy];
return
self;
}- (nsobject
*)messenger
- (nsobject
*)textures
- (void)publish:(nsobject*)value
- (void)addmethodcalldelegate:(nsobject
*)delegate
channel:(fluttermethodchannel*)channel ];
}*)delegate
- (nsstring*)lookupkeyforasset:(nsstring*)asset
- (nsstring*)lookupkeyforasset:(nsstring*)asset frompackage:(nsstring*)package
@end
@inte***ce
@property(nonatomic, strong) demoflutterbaseviewcontroller *rootcontroller;
@property(readonly, nonatomic) nsmutablearray* plugindelegates;
@property(readonly, nonatomic) nsmutabledictionary* pluginpublications;
@end
@implementation
/** ... 這裡寫**各種宣告週期事件給 plugin
*/for (id
plugin in _plugindelegates)
}return
yes;
}#pragma mark - getters for flutter
// 返回 flutterviewcontroller例項
- (flutterviewcontroller *)rootcontroller
- (nsobject
*)binarymessenger
return
nil;
}- (nsobject
*)textures
return
nil;
}- (nsobject
*)registrarforplugin:(nsstring*)pluginkey
- (bool)hasplugin:(nsstring*)pluginkey
- (nsobject*)valuepublishedbyplugin:(nsstring*)pluginkey
@end
首先在你的 flutter**目錄下執行一遍flutter build bundle
,這可以幫助我們打包出乙個 flutter asset,然後把這個flutter_assets
目錄拖入專案。
然後效果如圖:
其實這裡並沒有實現 hot reload,主要是目前 flutter工具鏈支援度還不好,不過 hot restart也夠用了。release模式和 debug下不一樣,我們需要做幾件事情:
把flutter.framework
替換成flutter/bin/cache/artifacts/engine/ios-release/flutter.framework
,因為上一步我們用的庫其實是 jit runtime
刪除工程裡面的flutter_assets
資料夾下的isolate_snapshot_data
、kernel_blob.bin
、platform.dill
、vm_snapshot_data
這幾個檔案
編譯打包給真機執行,效果如下:
debug時可以先打出包給 flutter開發者用,也可以直接新增乙個 build post action,直接呼叫 flutter 命令列,把 xcode和 flutter整合起來,不要像上文一樣全都手動,容易漏掉必要流程
release aot的自動化肯定要做,並且要和現有 ci整合
整合activiti到現有專案中
1.在lib中新增相關的jar包 2.找到乙個activiti.cfg.xml,若是想用現有的資料庫需要配置 並且在eclipse中畫出bpmn2.0流程圖,要想預設能夠載入到activiti.cfg.xml需要把該檔案放在根目錄src下,或者新建乙個source folder,並將該檔案放入其中,...
iOS專案整合flutter
1.建立flutter module 假設我們已經有了乙個ios專案,路徑為 path nativeaddflutter test 工程名 那我們要在testflutter同級目錄下建立 flutter module cd users huangzengsong desktop nativeaddf...
為iOS專案新增Daily Build
很多人在說到daily build的時候總是喜歡背書。背書就背書吧,總比混跡軟體行業連書都沒看過的強。很久以前遇到乙個奇葩。每次到 提交測的通知就著急忙慌的催促組員趕緊幹活,開始嚴重加班,晚飯都不吃。偶爾還需要開通宵。但是即使如此,最後也不會得到什麼好的反饋。那個team就是這樣迴圈往復的做著專案,...