HTTPS地址在iOS和Android上的行为不同
目前,使用Android应用程序为客户端为客户端修改日志记录逻辑,以便在iOS上工作。应用程序正在使用DIO进行HTTPS调用。地址作为字符串存储在单独的文件中(我们将其称为“设置”)。
显然无法提供原始链接,但它是这样的:
const String firstUrl = 'https://best-service-ever.com/access/';
const String secondUrl = 'https://another-good-service.com';
当前代码在记录脚本中看起来像这样的代码:
static Uri get firstUri => Uri.parse(settings.firstUrl);
static Uri get loginUri =>
firstUri.resolve('login').replace(queryParameters: <String, dynamic>{'service': settings.secondUrl});
android生成良好的loginuri - https://best-service-ever.com/access/ login?service = https:// another-good-service.com
,但出于iOS loginuri上的某些奇迹原因是https://best-service-ever-com/login? service=https:/service=https:/ /Another-Good-service.com
。
为什么以及仅在一个平台上进行解析时,终点将如何丢失?
**我也不能仅修改resolve('access/login')
我需要在多个位置中的地址。
**我目前正在MacOS上运行Flutter Channel稳定2.10.5 11.6.5
Currently modding logging logic for client with working Android app to also work on iOS. App is using DIO to make and handle https calls. Addresses are stored in a separate file as strings (lets call it 'settings').
Obviously cannot provide original links but it goes something like this:
const String firstUrl = 'https://best-service-ever.com/access/';
const String secondUrl = 'https://another-good-service.com';
Currently code looks like this in logging script:
static Uri get firstUri => Uri.parse(settings.firstUrl);
static Uri get loginUri =>
firstUri.resolve('login').replace(queryParameters: <String, dynamic>{'service': settings.secondUrl});
Android generates good loginUri- https://best-service-ever.com/access/login?service=https://another-good-service.com
But for some miraculous reason on ios loginURI is https://best-service-ever.com/login?service=https://another-good-service.com
.
Why and how the endpoint would be lost while parsing and only on one platform?
**Also I can't just modify resolve('access/login')
i need the address in multiple places as is.
**Also I'm currently running Flutter channel stable 2.10.5 on macOS 11.6.5
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
请这样尝试
please try this way
看起来这可能是扑朔迷离的错误。然后,我可能会这样做,这样
您仍然可以在代码的其余部分中使用原始
firsturl
It looks like it might be a bug in flutter. I would then maybe work around it by doing it like this
that way you can still use the original
firstUrl
in the rest of the code而不是使用
uri.parse
尝试uri.https
也许会有所帮助。查看此官方链接以获取更多信息
Instead of using
Uri.parse
tryUri.https
maybe it helps.Check out this official link for more information