HarmonyOS鸿蒙Next中iOS运行时应用崩溃 错误信息如下

【游戏多媒体】HarmonyOS鸿蒙Next中iOS运行时应用崩溃 错误信息:This app has crashed because it attempted to access privacy-sensitive data without a usage description

问题背景

在使用游戏多媒体joinTeamRoom和startRecordAudioToText方法的时候,应用崩溃。

image.png

崩溃信息:This app has crashed because it attempted to access privacy-sensitive data without a usage description. The app’s Info.plist must contain an NSMicrophoneUsageDescription key with a string value explaining to the user how the app uses this data.

问题分析

根据崩溃日志提示,应用崩溃的原因是它试图在没有使用说明的情况下访问隐私敏感数据。并且也说明了必须在Info.plist中包含一个NSMicrophone使用描述键向用户解释应用程序如何使用此数据。

由此可知,应用是缺少访问隐私敏感数据申明而导致的引用崩溃。

解决方案

在Info.plist中包含麦克风权限申明。

image.png

当权限申明好了之后,重新启动应用,再次调用joinTeamRoom和startRecordAudioToText方法的时候可以正常使用。

提示

在访问一些隐私数据的时候记得一定要在Info.plist中申请。


更多关于HarmonyOS鸿蒙Next中iOS运行时应用崩溃 错误信息如下的实战教程也可以访问 https://www.itying.com/category-93-b0.html

1 回复

更多关于HarmonyOS鸿蒙Next中iOS运行时应用崩溃 错误信息如下的实战系列教程也可以访问 https://www.itying.com/category-93-b0.html


该错误表明iOS运行时应用在HarmonyOS鸿蒙Next中尝试访问隐私敏感数据(如相机、麦克风、位置等),但未在Info.plist文件中提供相应的使用描述。解决方案是在Info.plist中添加相应的权限描述,例如:

  • 相机:NSCameraUsageDescription
  • 麦克风:NSMicrophoneUsageDescription
  • 位置:NSLocationWhenInUseUsageDescription

确保每个权限都有清晰的使用说明,避免应用崩溃并符合Apple的隐私政策。

回到顶部