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. iOS和Android共享HTTP深层链接?
- 4. 深入链接Xamarin iOS
- 5. 是否可以深层链接到Facebook活动页面?
- 6. 是否可以通过登录深度链接到Buddypress页面?
- 7. android深入链接增加
- 8. Android深入链接到应用程序
- 9. Android中的延期深入链接URL
- 10. Twitter卡是否可以与通用链接/ +深层链接一起工作?
- 11. 是否可以在ReST文字块中插入超链接?
- 12. 是否可以在Android中导入java.rmi。*?
- 13. 是否可以将Flutter应用注册为Android Intent Filter并处理传入意图?
- 14. 在Xamarin中,是否可以链接到.NET 4.0程序集?
- 15. WebView中的深度链接/通用链接是否工作?
- 16. 深入链接的Android应用程序
- 17. Android-是否可以将可点击链接添加到字符串资源中
- 18. 是否可以在Linux虚拟机上使用Flutter开发iOS应用程序?
- 19. iOS和Android移动应用程序深层链接
- 20. 是否可以将控件链接到iOS中的多个手势?
- 21. 是否可以使用Ajax进行深度链接而无需在链接中预先加上散列('#')
- 22. 推迟深度链接在Android中
- 23. 优步在iOS上的深度链接
- 24. iOS中的Facebook深层链接
- 25. 深度链接到Android或网络
- 26. 您可以深入链接到ASP.NET MVC 5中控制器的页面吗?
- 27. 是否可以在特定的js中直接链接?
- 28. Android和ios总是导致打开Play商店(浏览器 - 深度链接)
- 29. 是否可以执行差异链接?
- 30. 是否可以更改链接的href?