App bundle files appear to be missing when building for UnitTesting using GTM

60 views
Skip to first unread message

Charlie

unread,
Oct 22, 2008, 8:02:12 AM10/22/08
to google-toolbox-for-mac
I have an app that uses files in the App bundle. The normal app build
process under XCode copies these files into the bundle in the building
process.

I added these same files to the Unit Test target I created for unit
testing. However, when the application runs the unit tests (using the
build run script), the application cannot find the files. When I run
this using the 'Build and Run' under the App simulator, it appears to
work in the second execution.

When I run the unit tests in the build process, I do not see any files
written to Library/Application Support/iPhone Simulator/User/
Applications

When I run the unit tests using 'build and go', I do see these files
written.

Is there something else I need to do to get the App bundle available
to the unit testing application?

Charlie

unread,
Oct 22, 2008, 8:13:20 AM10/22/08
to google-toolbox-for-mac
Ok, I did some more digging and it appears that the app bundle is
elsewhere on the filesystem. It appears that the issue may be that
the simulator cannot write to the /Documents directory with the
current launch sequence.

Does anyone know how the simulator is configured with the root
directory for iphone application? It seems that we need to make sure
that this is set up properly for iPhone App testing when the
application writes to /Documents in its unit tests.

Dave MacLachlan

unread,
Oct 22, 2008, 10:01:39 AM10/22/08
to google-tool...@googlegroups.com
Charlie, how are you getting the path to the /Documents directory?

I assume you are using NSSearchPathForDirectoriesInDomains? It appears
to work for me. For your local bundled files you should be getting
them using NSBundle APIs.
Cheers,
Dave

Charlie

unread,
Oct 22, 2008, 3:44:44 PM10/22/08
to google-toolbox-for-mac
I am using NSSearchPathForDirectoriesInDomain(NSDocumentsDIrectory,
NSUserDomainMask) to get the /Documents location. This returns as
Library/Application Support/iPhone Simulator/Users/Documents (and this
directory does not exist).

I am using NSBundle resourcePath to get to the bundle. This does
point to the App bundle. Perhaps your environment already had
'Documents' created in the simulator space or I have something not
quite right in the configuration that generates the environment
variables to create this.

Do you get this as the NSDocumentsDirectory or something else?

I can code my application to try to create the directory if it does
not exist, but that is really coding around an unexpected condition.

Thanks,

Charlie

Dave MacLachlan

unread,
Oct 22, 2008, 5:28:21 PM10/22/08
to google-tool...@googlegroups.com
Apparently when running in the simulator, having the "documents"
directory not exist is an expected condition ;-)

It appears not to create it for you. I would recommend creating the
directory.

Cheers,
Dave

Reply all
Reply to author
Forward
0 new messages