我尝试在设备上运行GHUnit并收到以下编译错误。
ld: warning: directory not found for option '-L/Users/gtaskos/Documents/Projects/My/SDKs/My iOS SDK/My-iOS/Pods/build/Debug-iphoneos'
ld: warning: ignoring file /Users/gtaskos/Documents/Projects/My/SDKs/My iOS SDK/My-iOS/Frameworks/GHUnitIOS.framework/GHUnitIOS, missing required architecture arm64 in file /Users/gtaskos/Documents/Projects/My/SDKs/My iOS SDK/My-iOS/Frameworks/GHUnitIOS.framework/GHUnitIOS (4 slices)
Undefined symbols for architecture arm64:
"_OBJC_METACLASS_$_GHAsyncTestCase", referenced from:
_OBJC_METACLASS_$_MyMintTests in MyMintTests.o
"_OBJC_CLASS_$_GHAsyncTestCase", referenced from:
_OBJC_CLASS_$_MyMintTests in MyMintTests.o
"_OBJC_CLASS_$_GHTesting", referenced from:
objc-class-ref in MyMintTests.o
"_GHComposeString", referenced from:
___38-[MyMintTests testGetDetailsAsync]_block_invoke in MyMintTests.o
___38-[MyMintTests testGetDetailsAsync]_block_invoke38 in MyMintTests.o
-[MyMintTests testStrings] in MyMintTests.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
奇怪的是我尝试了https://github.com/gh-unit/gh-unit/tree/master/Examples/MyTestable-iOS
并且它的效果非常好。
一些配置/设置。我有一个带有静态库项目的工作区,它使用pod作为依赖项,在该项目中我有一个OCUnit测试目标,一个框架聚合并添加了一个配置为使用GHUnit的Empty Application目标,添加了框架并使用了{{1在GHUnitIOSAppDelegate
。
然后我添加了一个带有自定义名称MyMintGHUnitTests.m的Objective-C类,它有一些方法(虽然我运行目标时只有testStrings可用,这是StackOverflow的另一个问题)。
main.cs
类继承自- (void) testGetDetailsAsync
{
// Call prepare to setup the asynchronous action.
// This helps in cases where the action is synchronous and the
// action occurs before the wait is actually called.
[self prepare];
[self.utility getDetailsNumWithBlock:^(NSNumber *total)
{
GHTestLog(@"Details Number: %@", total);
GHAssertNotNil(totalCrashes, nil);
[self notify:kGHUnitWaitStatusSuccess forSelector:@selector(getDetailsAsyncTest)];
}
failure:^(NSError *error)
{
GHTestLog(@"Failed to get details: %@", error.description);
GHAssertNil(error, nil);
[self notify:kGHUnitWaitStatusSuccess forSelector:@selector(getDetailsAsyncTest)];
}];
// Wait until notify called for timeout (seconds); If notify is not called with kGHUnitWaitStatusSuccess then
// we will throw an error.
[self waitForStatus:kGHUnitWaitStatusSuccess timeout:5.0];
}
。
也许我应该说我也使用pod作为GHUnit目标。
目标在模拟器上运行(没有我的方法)在设备上完美失败。