Tom*_*ski 5 autofill ios flutter
我无法完全理解自动填充功能。Flutter 网站上的文档讨论了 IOS 所需的额外设置。
https://api.flutter.dev/flutter/material/TextField/autofillHints.html
设置您的 iOS 应用程序的关联域。
该文档讨论了将文件发布到受信任的站点上。过程本身以及将其添加到 Xcode 对我来说似乎很清楚。我的问题是这个文件到底应该是什么样子。
当然,我已经在 dart 中完全编写和配置了整个内容。它在 Android 上运行得很好。
谁能建议这个文件应该是什么样子?
"applinks": {
"details": [
{
"appIDs": [ "ABCDE12345.com.example.app", "ABCDE12345.com.example.app2" ],
"components": [
{
"#": "no_universal_links",
"exclude": true,
"comment": "Matches any URL whose fragment equals no_universal_links and instructs the system not to open it as a universal link"
},
{
"/": "/buy/*",
"comment": "Matches any URL whose path starts with /buy/"
},
{
"/": "/help/website/*",
"exclude": true,
"comment": "Matches any URL whose path starts with /help/website/ and instructs the system not to open it as a universal link"
},
{
"/": "/help/*",
"?": { "articleNumber": "????" },
"comment": "Matches any URL whose path starts with /help/ and which has a query item with name 'articleNumber' and a value of exactly 4 characters"
}
]
}
]
},
"webcredentials": {
"apps": [ "ABCDE12345.com.example.app" ]
},
"appclips": {
"apps": ["ABCED12345.com.example.MyApp.Clip"]
}
}```
Run Code Online (Sandbox Code Playgroud)
小智 1
仅当您想要自动填充凭据(自动填充电子邮件/用户名、自动生成钥匙串密码、将凭据保存到钥匙串并下次自动填充)时,才需要关联域设置。自动填充电话号码等应该在没有关联域的情况下工作。
如果您只需要凭据自动填充,则此文件将起作用:
{
"applinks": {
"details": [
{
"appIDs": [],
"components": []
}
]
},
"webcredentials": {
"apps": [
"ABCDE12345.com.example.app",
"ABCDE12345.com.example.app.dev"
]
},
"appclips": {
"apps": []
}
}
Run Code Online (Sandbox Code Playgroud)
如文档中所述,该文件必须位于
https://yourdomainwithoutredirects.com/.well-known/apple-app-site-association
发布关联文件后,在 xcode 中打开您的应用程序,选择“签名和功能”选项卡并添加以下关联域条目:
webcredentials:yourdomainwithoutredirects.com
首次安装应用程序时,设备会尝试加载 apple-app-site-association 文件。
请注意,该文件不是直接从您的 Web 服务器获取的,而是通过 Apple CDN 获取的。
从 macOS 11 和 iOS 14 开始,应用程序不再直接向您的 Web 服务器发送对 apple-app-site-association 文件的请求。相反,他们将这些请求发送到 Apple 管理的专用于关联域的内容分发网络 (CDN)。
您可以通过访问以下地址来检查您的文件是否已可通过 CDN 访问:
https://app-site-association.cdn-apple.com/a/v1/yourdomainwithoutredirects.com
如果您想跳过 CDN,请将 xcode 中的关联域条目更改为:
webcredentials:yourdomainwithoutredirects.com?mode=developer
现在使用 AutofillGroup 包装您的输入小部件,如有必要,添加 autofillHints 和 KeyboardType:
AutofillGroup(
child: TextFormField(
autofillHints: [AutofillHints.email],
keyboardType: TextInputType.emailAddress,
decoration: InputDecoration(
hintText: 'Email',
labelText: 'Email'
),
),
),
)
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
979 次 |
| 最近记录: |