Tôi đang cố chạy thử nghiệm GHUnit để chỉ kiểm tra xem trình thiết lập có thực sự hoạt động cho đối tượng NSManagedObject trong ứng dụng của tôi hay không. Ứng dụng của tôi được gọi là Máy và mục tiêu GHUnit của tôi được gọi là Thử nghiệm. Tôi đã thêm Máy làm phụ thuộc vào mục tiêu Kiểm tra. Đối tượng của tôi trong thử nghiệm được gọi là Mục tiêu. Đây là mã và lỗi trong Liên kết được hiển thị bên dưới.Lỗi liên kết GHUnit với Lớp ứng dụng
#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 i386 bình thường cd/Users/dlwhitehurst/Phát triển/Mã hóa/Mục tiêu-C/iPad/máy 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/Nhà phát triển/Nền tảng/iPhoneSimulato r.platform/Nhà phát triển/SDK/iPhoneSimulator4.3.sdk -L/Người dùng/dlwhitehurst/Thư viện/Nhà phát triển/Xcode/DerivedData/Máy-cscchzscengbcmcmeyzxlkbhumdn/Xây dựng/Sản phẩm/Gỡ lỗi-iphonesimulator -F/Người dùng/dlwhitehurst/Thư viện/Nhà phát triển/Xcode/DerivedData/Máy-cscchzscengbcmcmeyzxlkbhumdn/Xây dựng/Sản phẩm/Gỡ lỗi-iphonesimulator -F/Người dùng/dlwhitehurst/Phát triển/Khung -filelist/Người dùng/dlwhitehurst/Thư viện/Nhà phát triển/Xcode/DerivedData/Máy-cscchzscengbcmcmeyzxlkbhumdn/Xây dựng/Intermediates/Máy. build/Debug-iphonesimulator/Tests.build/Objects-normal/i386/Tests.LinkFileList -mmacosx-version-min = 10.6 -ObjC -all_load -Xlinker -objc_abi_version -Xlinker 2 -framework CoreData -framework GHUnitIOS -framework UIKit -framework Foundation -gramework CoreGraphics -o /Users/dlwhitehurst/Library/Developer/Xcode/DerivedData/Machine-cscchzscengbcmcmeyzxlkbhumdn/Build/Products/Debug-iphonesimulator/Tests.app/Tests
ký Không xác định cho kiến trúc i386: "_OBJC_CLASS _ $ _ Mục tiêu", tham chiếu từ: objc-đẳng cấp ref trong ControllerTests.o ld: biểu tượng (s) không tìm thấy cho kiến trúc i386 collect2: ld trở về 1 trạng thái thoát