nadol
nadol

Reputation: 53

Segmentation fault when trying to run tests in project using Quick

Here's how my LoginViewControllerSpec class looks like:

class LoginViewControllerSpec: QuickSpec {

override func spec() {
    describe("LoginViewController") {
        var loginViewController: LoginViewController!

        beforeEach {
            loginViewController = LoginViewController()
        }
    }
}

When trying to run this particular test I'm getting error saying

Command failed due to signal: Segmentation fault: 11

I've found out that this is caused by my LoginViewController implementing BSKeyboardControlsDelegate, which is Objective-C library installed through CocoaPods.

So I guess it's caused by the fact that BSKeyboardControls is not accessible from my Test bundle.

Here's my Podfile:

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
inhibit_all_warnings!

pod 'BSKeyboardControls'

target 'SwitchboardTests' do
  use_frameworks!
  pod 'Quick'
  pod 'Nimble'
end

I've tried adding link_with to link BSKeyboardControls with my test bundle but it's not working.

I'd appreciate some advices how should I configure my project, and how my Podfile should look like.

Upvotes: 1

Views: 67

Answers (1)

nadol
nadol

Reputation: 53

I'm posting an answer in case someone else encountered similar problem.

The solution was to move use_frameworks! out of target scope. So right now I'm using frameworks also for Objective-C pods. Doing it this way you don't longer need to import your Objective-C libs in bridging header and you simply import them like that: import BSKeyboardControls

Upvotes: 1

Related Questions