2011-06-18 8 views
5

Próbuję uruchomić test GHUnit, aby przetestować, czy program ustawiający działa poprawnie dla obiektu NSManagedObject w mojej aplikacji. Moja aplikacja nazywa się Maszyna, a mój cel GHUnit nazywa się Testami. Dodałem maszynę jako zależność od celu testu. Mój obiekt w teście nazywa się Cel. Oto kod, a błąd w linku pokazano poniżej.Błąd GHUnit Linker z klasami aplikacji

#import <GHUnitIOS/GHUnit.h> 
#import <CoreData/CoreData.h> 
#import "Goal.h" 
#import "GoalRec.h" 

@interface ControllerTests : GHTestCase { } 
@property (retain) Goal *goal; 
@end 

@implementation ControllerTests 
@synthesize goal; 

- (BOOL)shouldRunOnMainThread { 
// By default NO, but if you have a UI test or test dependent on running on the main thread return YES 
return NO; 
} 

- (void)setUpClass { 
    // Run at start of all tests in the class 
} 

- (void)tearDownClass { 
    // Run at end of all tests in the class 
} 

- (void)setUp { 
    // Run before each test method 
    self.goal = [[[Goal alloc] init] autorelease]; 
} 

- (void)tearDown { 
    // Run after each test method 
    self.goal = nil; // prevents memory leak 
} 

- (void)testImageArray { 

    NSString *str = @"Hello"; 
    Goal *obj = self.goal; 
    obj.goal = str; 
    GHAssertEqualStrings(obj.goal, @"Hello", nil); 

} 

@end

Ld /Users/dlwhitehurst/Library/Developer/Xcode/DerivedData/Machine-cscchzscengbcmcmeyzxlkbhumdn/Build/Products/Debug-iphonesimulator/Tests.app/Tests normalny i386 cd/Użytkownicy/dlwhitehurst/Development/Coding/Objective-C/iPad/machine setenv MACOSX_DEPLOYMENT_TARGET 10.6 setenv PATH "/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Developer/usr/bin:/usr/bin:/ bin:/usr/sbin:/sbin " /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/llvm-gcc-4.2 -arch i386 -isysroot/Deweloper/Platformy/iPhoneSimulato r.platform/Developer/SDKs/iPhoneSimulator4.3.sdk -L/Users/dlwhitehurst/Library/Developer/Xcode/DerivedData/Machine-cscchzscengbcmcmeyzxlkbhumdn/Build/Produkty/Debug-iphonesimulator -F/Users/dlwhitehurst/Library/Developer/Xcode/DerivedData/Machine-cscchzscengbcmcmeyzxlkbhumdn/Build/Products/Debug-iphonesimulator -F/Users/dlwhitehurst/Rozwój/Frameworks -filelist/Users/dlwhitehurst/Library/Developer/Xcode/DerivedData/Machine-cscchzscengbcmcmeyzxlkbhumdn/Build/Intermediates/Machine. build/Debug-iphonesimulator/Tests.build/Objects-normal/i386/Tests.LinkFileList -mmacosx-version-min = 10,6 -ObjC -all_load -Xlinker -objc_abi_version -Xlinker 2-ramka CoreData-ramka GHUnitIOS-ramka UIKit-ramka Foundation -R Framework CoreGraphics -o /Users/dlwhitehurst/Library/Developer/Xcode/DerivedData/Machine-cscchzscengbcmcmeyzxlkbhumdn/Build/Products/Debug-iphonesimulator/Tests.app/Tests

niezdefiniowane symbole dla architektury i386: "_OBJC_CLASS _ $ _ Cel", przywoływane z: objc-klasa-ref w ControllerTests.o ld: Symbol (e) nie znaleziono dla architektury i386 collect2: ld zwróconym 1 exit status

Odpowiedz

0

Lepszym rozwiązaniem może być skopiowanie celu podczas tworzenia go do testu GHUnit zamiast tworzenia nowego celu.

Powiązane problemy