0
A
回答
2
您可以使用platform channel。它不應該很難。您需要在本地代碼中添加處理程序,並通過通道重定向url以晃動代碼。 實施例爲iOS:
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[GeneratedPluginRegistrant registerWithRegistry:self];
FlutterViewController *controller = (FlutterViewController*)self.window.rootViewController;
self.urlChannel = [FlutterMethodChannel methodChannelWithName:@"com.myproject/url" binaryMessenger:controller];
return [super application:application didFinishLaunchingWithOptions:launchOptions];
}
- (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options{
[self.urlChannel invokeMethod:@"openURL"
arguments:@{@"url" : url.absoluteString}];
return true;
}
@end
和基本撲代碼:
class _MyHomePageState extends State<MyHomePage> {
final MethodChannel channel = const MethodChannel("com.myproject/url");
String _url;
@override
initState() {
super.initState();
channel.setMethodCallHandler((MethodCall call) async {
debugPrint("setMethodCallHandler call = $call");
if (call.method == "openURL") {
setState(() => _url = call.arguments["url"]);
}
});
}
@override
Widget build(BuildContext context) {
return new Scaffold(
appBar: new AppBar(
title: new Text(_url ?? "No URL"),
),
);
}
}
相關問題
- 1. iOS深度鏈接和通用鏈接,如何在ios中深入鏈接
- 2. 在Facebook上深入鏈接到Android和iOS應用程序
- 3. 鏈接是否可以鏈接到csrf?
- 4. iOS和Android共享HTTP深層鏈接?
- 5. 深入鏈接Xamarin iOS
- 6. 是否可以深層鏈接到Facebook活動頁面?
- 7. 是否可以通過登錄深度鏈接到Buddypress頁面?
- 8. 是否可以深入鏈接到iOS上的Facebook移動應用程序中的特定頁面或位置?
- 9. android深入鏈接增加
- 10. Android深入鏈接到應用程序
- 11. iOS sdk:如何找到鏈接是否可以下載?
- 12. Android中的延期深入鏈接URL
- 13. Twitter卡是否可以與通用鏈接/ +深層鏈接一起工作?
- 14. 是否可以將Flutter應用註冊爲Android Intent Filter並處理傳入意圖?
- 15. 深入鏈接iOS推送通知
- 16. 是否可以直接鏈接到「費率和審查」?
- 17. 是否可以在ReST文字塊中插入超鏈接?
- 18. 是否可以在Android中嵌入TTS?
- 19. 是否可以在Android中導入java.rmi。*?
- 20. 是否可以從Android連接到MSMQ?
- 21. iOS的深度鏈接
- 22. 是否可以在Google Plus文章中鏈接到自己?
- 23. 在Xamarin中,是否可以鏈接到.NET 4.0程序集?
- 24. 是否可以在Linux虛擬機上使用Flutter開發iOS應用程序?
- 25. WebView中的深度鏈接/通用鏈接是否工作?
- 26. Android-是否可以將可點擊鏈接添加到字符串資源中
- 27. 深入鏈接的Android應用程序
- 28. 在WebView中打開而不是在iOS上的深層鏈接
- 29. 是否可以使用Ajax進行深度鏈接而無需在鏈接中預先加上散列('#')
- 30. 是否可以將控件鏈接到iOS中的多個手勢?