1

我尝试在设备上运行 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 的空应用程序目标,添加了框架并GHUnitIOSAppDelegatemain.cs.

然后我添加了一个具有自定义名称 MyMintGHUnitTests.m 的 Objective-C 类,它有一些方法(虽然当我运行目标时只有 testStrings 可用,这是 StackOverflow 的另一个问题)。

- (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];
    }

类继承自GHAsyncTestCase.

也许我应该说我也将 pod 用于 GHUnit 目标。

目标在模拟器上运行(没有我的方法)在设备上完美失败。

4

0 回答 0