离子 NSPhotoLibraryUsageDescription、NSCameraUsageDescription、NSMicrophoneUsageDescription

smo*_*yth 0 ionic-framework

我如何处理在 Ionic 中添加这些描述的方式,我可以签入 repo 并在构建时自动包含这些描述?

smo*_*yth 5

尝试将类似的内容放在您的/hooks/after_prepare目录中,例如 filename 030_add_ios_usage_descriptions.sh

#!/bin/bash

PLIST=platforms/ios/*/*-Info.plist

cat << EOF |
Delete :NSPhotoLibraryUsageDescription
Add :NSPhotoLibraryUsageDescription string "For meal photos"
Delete :NSCameraUsageDescription
Add :NSCameraUsageDescription string "For meal photos"
Delete :NSMicrophoneUsageDescription
Add :NSMicrophoneUsageDescription string "For voice notes"
EOF
while read line
do
  /usr/libexec/PlistBuddy -c "$line" $PLIST
done

true
Run Code Online (Sandbox Code Playgroud)

您可能还需要对chmod +x文件运行。