1 Reply
      Latest reply: Jan 12, 2017 2:01 PM by eskimo RSS
      actionman Level 1 Level 1 (0 points)

        Hello there,

         

        I am trying to use the photos framework from within a XCTestCase because I dont want to verify that an asset gets saved to the user's photo library when they tap on a button in our app. But app is crashing when I run the test. I did NSPhotoLibraryUsageDescription to my test target's plist but it looks like thats not the right place to add it. Here is the error I am seeing in the console:

         

        XCTRunner[25404:8392034] [access] This app has crashed because it attempted to access privacy-sensitive data without a usage description.  The app's Info.plist must contain an NSPhotoLibraryUsageDescription key with a string value explaining to the user how the app uses this data.

         

        So it looks like I need to add NSPhotoLibraryUsageDescription to XCTRunner's plist but how do I do that? Is there an alternative?

         

        thanks,

        -Akshay

        • Re: Can't use the Photos framework from within XCTestCase
          eskimo Apple Staff Apple Staff (6,310 points)

          It sounds like you’re creating a library test when you should be creating an app testTesting 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 Info.plist.

          Share and Enjoy

          Quinn “The Eskimo!”
          Apple Developer Relations, Developer Technical Support, Core OS/Hardware
          let myEmail = "eskimo" + "1" + "@apple.com"