Ionic NSPhotoLibraryUsageDescription,NSCameraUsageDescription,NSMicrophoneUsageDescription

时间:2016-11-22 19:28:45

标签: ionic-framework

我如何处理在Ionic中添加这些描述的方式,我可以检查回购并自动包含在构建中?

1 个答案:

答案 0 :(得分:4)

尝试将此类内容放入/hooks/after_prepare目录中,例如文件名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

您可能还需要在文件上运行chmod +x