0

I have this iOS module that creates and writes to some plist files in NSApplicationSupportDirectory, and I'd like to test that the module is performing these writes correctly. However, the writes don't seem to be going through - after calling the module method, the file seems to not exist. I've also tried writing to the desired file directly from the unit test module, and that doesn't seem to do anything either - using NSDictionary writeToFile returns NO, indicating that the write failed.

Is it impossible to write to this directory from a unit test environment, or is it more likely that I just screwed something up? And if it is indeed impossible to perform this write, what would the proper way to test this behavior be? If anyone needs more details, I'd be happy to provide them.

Thanks!

Thom Lv
  • 111
  • 2

1 Answers1

0

Discovered my own error: The NSApplicationSupportDirectory simply doesn't exist by default (this is why the write is failing). You need to create the directory before you can use it. See this post:

iOS: Can't save file to 'Application Support' folder, but can to 'Documents'

Community
  • 1
  • 1
Thom Lv
  • 111
  • 2