如何更改“相机和照片库权限”说明?

时间:2019-05-04 12:45:05

标签: ios

我已经在NSCameraUsageDescription和NSPhotoLibraryUsageDescription字段的info.plist文件中指定了所需的文本,但是没有任何改变。

始终使用相同的系统文本“此应用程序需要访问相机”和“此应用程序需要访问照片库”。我已经尝试在代码中找到它。没找到。我在文件info.plist中指定,在我使用的所有库中添加NSCameraUsageDescription和NSPhotoLibraryUsageDescription键。一样都没有改变。

info.plist文件

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>CFBundleDevelopmentRegion</key>
    <string>$(DEVELOPMENT_LANGUAGE)</string>
    <key>CFBundleDisplayName</key>
    <string>Mona</string>
    <key>CFBundleExecutable</key>
    <string>$(EXECUTABLE_NAME)</string>
    <key>CFBundleIdentifier</key>
    <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
    <key>CFBundleInfoDictionaryVersion</key>
    <string>6.0</string>
    <key>CFBundleName</key>
    <string>$(PRODUCT_NAME)</string>
    <key>NSCameraUsageDescription</key>
    <string>The program wants to access the camera so you can use your photos and camera in this photo editor.</string>
    <key>NSPhotoLibraryUsageDescription</key>
    <string>The program wants to access the photo gallery so you can use your photos and camera in this photo editor.</string>
    <key>CFBundlePackageType</key>
    <string>APPL</string>
    <key>CFBundleShortVersionString</key>
    <string>1.0</string>
    <key>CFBundleVersion</key>
    <string>1</string>
    <key>LSRequiresIPhoneOS</key>
    <true/>
    <key>UIMainStoryboardFile</key>
    <string>Main</string>
    <key>UIRequiredDeviceCapabilities</key>
    <array>
        <string>armv7</string>
    </array>
    <key>UISupportedInterfaceOrientations</key>
    <array>
        <string>UIInterfaceOrientationPortrait</string>
        <string>UIInterfaceOrientationLandscapeLeft</string>
        <string>UIInterfaceOrientationLandscapeRight</string>
    </array>
    <key>UISupportedInterfaceOrientations~ipad</key>
    <array>
        <string>UIInterfaceOrientationPortrait</string>
        <string>UIInterfaceOrientationPortraitUpsideDown</string>
        <string>UIInterfaceOrientationLandscapeLeft</string>
        <string>UIInterfaceOrientationLandscapeRight</string>
    </array>
    <key>UIViewControllerBasedStatusBarAppearance</key>
    <false/>
</dict>
</plist>

警告图片 Alert image

请帮助我。告诉我如何更改这些查询的描述。

1 个答案:

答案 0 :(得分:0)

该字符串存在于您正在使用的Gallery lib的示例项目中。

   grep -r requires .

返回:

./Gallery-2.2.0/Example/GalleryDemo/GalleryDemo/Info.plist:     <string>This app requires access to camera</string>
./Gallery-2.2.0/Example/GalleryDemo/GalleryDemo/Info.plist:     <string>This app requires access to photo library</string>

这可能有几个原因:

  1. 错误的列表

使用您发布的.plist,但上面的一个

  1. Xcode缓存

您正在使用与用于运行Gallery示例代码相同的包ID。确保不使用缓存:

  • 关闭Xcode
  • 从设备/模拟器中删除应用
  • 清除派生数据
  • 打开Xcode,构建并运行