Flutter 真机和模拟器中未出现 HealthKit Permission 弹出窗口
我在flutter中使用了health package来获取Android中的步数和跑步数据Google Fit和身体活动权限设置完美,但在 iOS 中,它不要求健康套件权限,所有其他权限都工作得很好,这是我为权限请求编写的代码
Future<void> requestActivityPermission() async {
if (Platform.isAndroid) {
final permissionStatus = await Permission.activityRecognition.request();
if (permissionStatus.isDenied || permissionStatus.isPermanentlyDenied) {
_activityPermanenetlyDeniedCase();
return;
} else {
permissionStatus.isGranted;
fetchTotalStepData();
}
} else {
final permissionStatus = await Permission.activityRecognition.request();
if (permissionStatus.isDenied || permissionStatus.isPermanentlyDenied) {
_activityPermanenetlyDeniedCase();
return;
} else {
permissionStatus.isGranted;
fetchTotalStepData();
}
}
}
requestActivityPermission 函数在 initState 方法中调用。
_activityPermanenetlyDeniedCase 函数直接打开,在该函数中我有一个显示打开设置的对话框,但在该设置中没有 healthkit 权限。
我期待 healthKit 的弹出许可
I had used the health package in flutter for steps and running data in android the google fit and physical activity permission are set perfectly but in iOS, it is not asking for health kit permission all other permissions are working perfectly fine here is the code which I had written for permission request
Future<void> requestActivityPermission() async {
if (Platform.isAndroid) {
final permissionStatus = await Permission.activityRecognition.request();
if (permissionStatus.isDenied || permissionStatus.isPermanentlyDenied) {
_activityPermanenetlyDeniedCase();
return;
} else {
permissionStatus.isGranted;
fetchTotalStepData();
}
} else {
final permissionStatus = await Permission.activityRecognition.request();
if (permissionStatus.isDenied || permissionStatus.isPermanentlyDenied) {
_activityPermanenetlyDeniedCase();
return;
} else {
permissionStatus.isGranted;
fetchTotalStepData();
}
}
}
The requestActivityPermission function is called in the initState Method.
The _activityPermanenetlyDeniedCase function directly opens up, in that function i had a dialog box showing open setting, but in the setting there is no healthkit permission.
I am expecting a popup permission for healthKit
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您需要在
ios/
目录下的Info.plist
文件中指定您使用的权限。请参阅此处
You need to specify which permission you are using in
Info.plist
file underios/
directory.Refer here
检查 healthkit 是否在调试和发布选项卡中均已激活
Check that the healthkit is activated in both the debug and release tabs