Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Undefined symbols when compiling for unit tests #86

Open
kuyazee opened this issue Jun 21, 2019 · 1 comment
Open

Undefined symbols when compiling for unit tests #86

kuyazee opened this issue Jun 21, 2019 · 1 comment
Labels

Comments

@kuyazee
Copy link
Contributor

kuyazee commented Jun 21, 2019

I've setup unit tests for my project and want to add View/ViewController instantiation to the tests because the project is modular. When compiling this error message appears when for any methods that came from Reusable.

Undefined symbols for architecture x86_64:
  "static (extension in Reusable):Reusable.StoryboardSceneBased< where A: __C.UIViewController>.instantiate() -> A", referenced from:
      implicit closure #1 () throws -> FooProject.HomeViewController? in FooProjectTests.InstantiationTests.testInstantiations() -> () in InstantiationTests.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

I'm not sure why this is happening because the other frameworks can be accessed easily. This is a sample code that generates the error

@testable import FooProject
import Nimble
import XCTest

class InstantiationTests: XCTestCase {
    func testInstantiations() {
        expect(HomeViewController.instantiate()).notTo(raiseException())
    }
}

Possible Faqs

Is the project enabled for testability
Yes

Do you have other tests besides this?
Yes

What do you mean by the project being modular?
The project has multiple Targets and Configurations. ex

Configurations

  • Release
  • Release Debug
  • Staging
  • Staging Debug

Targets

  • FooProject
  • FooProjectV2
@AliSoftware
Copy link
Owner

How are you integrating Reusable into your project? CocoaPods? Carthage?

Check that Reusable.framework is linked to your test target – typically that error means that your test target isn't linked with the framework.

  • If you're using CocoaPods, ensure that you also put pod 'Reusable' in your target "FooProjectTests" in addition to your main target
  • If you're using Carthage. ensure that you used the "+" button to add Reusable.framework to the "Link Binary with Libraries" Build Phase of your Test Target.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants