4

I'm trying write unit tests for code that works directly against EventKit. This requires an info.plist entry to describe the reason for needing access to the calendar just like you need to do for Camera access, GPS, etc.

I had added the appropriate entry to test target info.plist but I get a runtime error:

2016-10-13 20:07:18.477916 myapp[18252:6774056] [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 NSCalendarsUsageDescription key with a string value explaining to the user how the app uses this data

As mentioned here it seems that unit tests run in a harness. However test projects do get an info.plist file but it's not the "main" info.plist. Is there some way to get past this issue? How do folks unit test code that talks to EventKit or does Location work?

Community
  • 1
  • 1
SlashDevSlashGnoll
  • 2,141
  • 1
  • 12
  • 15
  • Did you add that key to the test target's Info.plist as well? You don't explicitly mention that so it seems like you added it to the main target only. – Dima Oct 14 '16 at 00:46
  • Yes, sorry for being ambiguous, I've edited the post to make that more clear. – SlashDevSlashGnoll Oct 14 '16 at 01:10
  • This seems to me to be a major bug. It's nice that Apple is now enforcing the rules about the Info.plist with this crash, but they shouldn't do that for the test harness app. I'd report this if I were you. – matt Oct 14 '16 at 01:20
  • I've submitted a bug. Hopefully they get to it soon. While on this topic does anyone definitely know how test harnesses deal with APIs that require user permissions such as camera, location services, eventkit? (or at least how they USED to work?) I'm wondering how you can properly test code against those APIs. – SlashDevSlashGnoll Oct 17 '16 at 03:16

0 Answers0