钥匙串未在 iOS 上触发
Keychain not firing on iOS
钥匙串不会自动填写我在 iOS 上的登录表单。
在 xCode 中,我将钥匙串共享设置为开启,并且我在两个步骤旁边都有复选标记:将钥匙串共享权利添加到您的权利文件并将钥匙串共享功能添加到您的应用程序 ID。
<TextField
class="input"
hint="Email"
keyboardType="email"
autocorrect="false"
autocapitalizationType="none"
v-model="user.email"
returnKeyType="next"
@returnPress="focusPassword"
fontSize="18"
/>
<StackLayout class="hr-light"/>
</StackLayout>
<StackLayout class="input-field" marginBottom="15">
<TextField
ref="password"
class="input"
hint="Password"
secure="true"
v-model="user.password"
:returnKeyType="isLoggingIn ? 'done' : 'next'"
fontSize="18"
/>
<StackLayout class="hr-light"/>
</StackLayout>
我很确定问题是我需要将 textContentType
设置为 .username & .password 但我不确定如何设置。
您必须在 nativeView 上设置 textContentType
,
向 TextField 添加 loaded
事件
<TextField
class="input"
hint="Email"
keyboardType="email"
autocorrect="false"
autocapitalizationType="none"
v-model="user.email"
returnKeyType="next"
@loaded="onLoaded"
@returnPress="focusPassword"
fontSize="18"
/>
在 nativeView
上更新 textContentType
onLoaded: function(args) {
const textField = args.object;
if (textField.ios) {
textField.ios.textContentType = UITextContentTypeEmailAddress;
}
}
textContentType
应该是 docs here 中的值之一。
还要确保 运行 此代码仅适用于 iOS 11 或更高版本。如果您支持 iOS10,这行代码可能会抛出异常。如果您支持 iOS 10,则必须在 if
条件下检查平台版本。
钥匙串不会自动填写我在 iOS 上的登录表单。
在 xCode 中,我将钥匙串共享设置为开启,并且我在两个步骤旁边都有复选标记:将钥匙串共享权利添加到您的权利文件并将钥匙串共享功能添加到您的应用程序 ID。
<TextField
class="input"
hint="Email"
keyboardType="email"
autocorrect="false"
autocapitalizationType="none"
v-model="user.email"
returnKeyType="next"
@returnPress="focusPassword"
fontSize="18"
/>
<StackLayout class="hr-light"/>
</StackLayout>
<StackLayout class="input-field" marginBottom="15">
<TextField
ref="password"
class="input"
hint="Password"
secure="true"
v-model="user.password"
:returnKeyType="isLoggingIn ? 'done' : 'next'"
fontSize="18"
/>
<StackLayout class="hr-light"/>
</StackLayout>
我很确定问题是我需要将 textContentType
设置为 .username & .password 但我不确定如何设置。
您必须在 nativeView 上设置 textContentType
,
向 TextField 添加 loaded
事件
<TextField
class="input"
hint="Email"
keyboardType="email"
autocorrect="false"
autocapitalizationType="none"
v-model="user.email"
returnKeyType="next"
@loaded="onLoaded"
@returnPress="focusPassword"
fontSize="18"
/>
在 nativeView
上更新textContentType
onLoaded: function(args) {
const textField = args.object;
if (textField.ios) {
textField.ios.textContentType = UITextContentTypeEmailAddress;
}
}
textContentType
应该是 docs here 中的值之一。
还要确保 运行 此代码仅适用于 iOS 11 或更高版本。如果您支持 iOS10,这行代码可能会抛出异常。如果您支持 iOS 10,则必须在 if
条件下检查平台版本。