所以我正在使用 inappwebview 的 flutter 应用程序中工作,这是应用程序中的一个简单的导航器,允许用户直接从本机应用程序访问网络平台(公司请求)。
尝试访问的应用程序具有生物识别身份验证作为向用户授予访问权限的选项。
问题是该应用程序没有访问生物识别凭据的权限,而且我不知道如何授予它们。我已将登录功能添加到 xcode 中的所有(发布、调试和配置文件)阶段,以及 Info.plist 的
NSFaceIDUsageDescription
。
这是 xcode 在 flutter 应用中点击 activate 时显示的错误。
ASAuthorizationController credential request failed with error: Error Domain=com.apple.AuthenticationServices.AuthorizationError Code=1004 "(null)"
应用程序错误
预期的行为,这就是尝试从普通浏览器访问并单击“激活”时发生的情况
这是启动 inappwebview 的 flutter 代码
import 'package:flutter/material.dart';
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
import 'dart:io' show Platform;
class HomePageWidget extends StatefulWidget {
const HomePageWidget({super.key});
@override
_HomePageWidgetState createState() => _HomePageWidgetState();
}
class _HomePageWidgetState extends State<HomePageWidget> {
late MyInAppBrowser browser;
final settings = InAppBrowserClassSettings(
browserSettings: InAppBrowserSettings(
hideToolbarBottom: true,
hideCloseButton: true,
hideUrlBar: true,
hideTitleBar: true,
hideDefaultMenuItems: true,
presentationStyle: ModalPresentationStyle.OVER_FULL_SCREEN),
webViewSettings: InAppWebViewSettings(
userAgent: Platform.isAndroid
? "Mozilla/5.0 (Linux; Android 14) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.6367.82 Mobile Safari/537.36"
: "Mozilla/5.0 (iPhone; CPU iPhone OS 17_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.4.1 Mobile/15E148 Safari/604.1",
cacheEnabled: true,
javaScriptEnabled: true,
isElementFullscreenEnabled: true,
));
// Assuming this is the correct type
@override
void initState() {
super.initState();
browser = MyInAppBrowser(onBrowserExit: () {
setState(() {
// Handle browser exit if needed
});
});
openBrowser();
}
void openBrowser() async {
await browser.openUrlRequest(
urlRequest: URLRequest(
url: WebUri(
"https://linktowebapp")),
settings: settings);
// Additional logic if necessary
}
@override
Widget build(BuildContext context) {
// Your build method as before, but replace the onPressed method:
return const Scaffold(
body: Center(),
);
}
}
// Modify the MyInAppBrowser class to accept a callback
class MyInAppBrowser extends InAppBrowser {
final VoidCallback onBrowserExit;
MyInAppBrowser({required this.onBrowserExit});
@override
void onExit() {
super.onExit();
print("Browser closed!");
onBrowserExit(); // Call the provided callback
}
// The rest of your MyInAppBrowser implementation...
}