Unit testing of static library that involves NSDocumentDirectory and other iOS App specific calls.

Posted by Shiun on Stack Overflow See other posts from Stack Overflow or by Shiun
Published on 2011-01-04T18:35:12Z Indexed on 2011/01/05 23:53 UTC
Read the original article Hit count: 129

Hi,

I'm attempting to run unit tests for a static library that attempts to create/write/read a file in the document directory. Since this is a static library and not an application for the iOS, attempts to reference the NSDocumentDirectory is returning me directory for the form

"/Users//Library/Application Support/iPhone Simulator/Documents"

This directory does not exist. When attempting to access a directory from an actual application, the NSDocumentDirectory returns something of the form:

"/Users//Library/Application Support/iPhone Simulator/4.2/FEDBEF5F-1326-4383-A087-CDA1B865E61A/Documents"

(Please note the simulator version as well as application ID as part of the path)

How can I overcome this shortcoming in the unit test framework for static libraries that implement tests that require iOS app specific calls?

Thanks in advance.

© Stack Overflow or respective owner

Related posts about iphone

Related posts about unit-testing