Anthony Main
Anthony Main

Reputation: 6068

UnitTesting on iPhone doesn't build

I am trying to perform some unit testing on the iphone but for some reason I cannot get it to build the executable

I have downloaded TestMyApp from the Standford lecture slides and that compiles and runs perfectly. I have created a test project and even gone as far as to use the test code from the Stanford sample but for some reason depsite every setting looking identical I get the following precompiler errors:

/System/Library/Frameworks/Cocoa.framework/Headers/Cocoa.h:13:26: error: AppKit/AppKit.h: No such file or directory /System/Library/Frameworks/Cocoa.framework/Headers/Cocoa.h:14:30: error: CoreData/CoreData.h: No such file or directory

N.B> Only other point to note is that Im running it on a "tweaked" xcode install on a PPC not an Intel mac

Upvotes: 2

Views: 2949

Answers (6)

Reputation:

I had to remove the value for GCC_PREFIX_HEADER in the "User Defined Section". It was using $(SYSTEM_LIBRARY_DIR)/Frameworks/Cocoa.framework/Headers/Cocoa.h

Once I removed that, I got past this problem.

Upvotes: 1

tmadsen
tmadsen

Reputation: 951

Do not use the Sen:te thing for testing any classes that make use of the UIKit framework. It will fail with code 139. Use Google's GTM.

Upvotes: 0

nst
nst

Reputation: 3882

You can find instructions and a sample project on Sen:te web site: http://www.sente.ch/s/?p=535&lang=en

Upvotes: 1

user42311
user42311

Reputation:

If you right click on your unit test target and select the "get info" menu you will see your target options. At the bottom of the pane, you'll see a section called "User Defined": remove the entry containing the path to cocoa.h. I don't remember the name of this entry as I removed it, but this fixes the same problem I had before.

I also changed Base SDK to be Device - iPhone OS 2.2 and other linker flags to -framework Foundation -framework SentestingKit

Upvotes: 3

hanleyp
hanleyp

Reputation: 811

Do you have the iPhone SDK 2.2 installed? Without using the GTM for iPhone, OCunit doesn't work with iPhone SDK < 2.2.

I have been working with the Stanford example code as well. When I try to set up my own project, I wasn't able to get my tests to run. So, I took the Stanford example projects and renamed everything. Now the OCunit testing is working fine.

Upvotes: 0

Ryan Townshend
Ryan Townshend

Reputation: 2394

AppKit is not available for iPhone development. Looks like you downloaded a desktop mac app project. iPhone dev uses UIKit in place of AppKit. CoreData is not available for iPhone dev as well.

Try setting up a Desktop cocoa application, and these frameworks and objects should be available.

For unit testing an iPhone app, the Google Toolbox for mac is useful.

GTM iPhone docs

Upvotes: 1

Related Questions