It sounds like you’re creating a library test when you should be creating an app test. Testing with Xcode explains that terminology. A library test is run by Xcode infrastructure and you can’t tweak its
Info.plist. An app test, OTOH, is run within your app, and that gives you control over the
Share and Enjoy
Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware
let myEmail = "eskimo" + "1" + "@apple.com"
Perhaps you're trying to access the photo library from a UI test.
Xcode doesn't provide a built-in way to modify the test runner app's Info.plist. (Your UI test bundle has an Info.plist but your UI test bundle is not the main bundle.)
I was able to hack it using a Run Script build phase.
Find your UI test bundle target in your project and go to its Build Phases tab. Add a Run Script build phase. Here's the script:
set -x -e /usr/libexec/PlistBuddy -c 'Delete :NSPhotoLibraryUsageDescription' $CODESIGNING_FOLDER_PATH/Info.plist || true /usr/libexec/PlistBuddy -c 'Add :NSPhotoLibraryUsageDescription string Testing' $CODESIGNING_FOLDER_PATH/Info.plist
This worked for me in Xcode 9 beta 3. I don't know if it works in older Xcodes, and it's quite possible that it won't work in future versions.