kylef / Mockingjay

An elegant library for stubbing HTTP requests with ease in Swift

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

dyld: lazy symbol binding failed: Symbol not found

trick14 opened this issue · comments

I have been using Mockingjay in XCTest very well. However recently I noticed that if I can use it in main target, it would be nice. So I changed Podfile like this:

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '9.0'
use_frameworks!

inhibit_all_warnings!

target 'Surfline' do
    pod 'Mockingjay/Core'

    target 'SurflineTests' do
        pod 'Mockingjay/XCTest'
    end
end

And it worked very well with main target but I stuck in test.

I have this line in my test

@testable import MainTarget

I need this for not to change access level of class properties in the main target. Tests without the line is perfectly fine but with the line it shows error:

dyld: lazy symbol binding failed: Symbol not found: __TFE10MockingjayCSo6XCTest4stubfTFV10Foundation10URLRequestSbFS2_OS_8Response_VS_4Stub
  Referenced from: /Users/rhan/Library/Developer/Xcode/DerivedData/Surfline-eheubjimlqgiykerufbqqnwywuhs/Build/Intermediates/CodeCoverage/Products/Debug-iphonesimulator/Surfline.app/PlugIns/SurflineTests.xctest/SurflineTests
  Expected in: /Users/rhan/Library/Developer/CoreSimulator/Devices/9C5026F0-B25E-40C1-99FB-0E1F63FAFC3F/data/Containers/Bundle/Application/734A040B-E1D2-45F8-93A4-3ADFA837010B/Surfline.app/Frameworks/Mockingjay.framework/Mockingjay

dyld: Symbol not found: __TFE10MockingjayCSo6XCTest4stubfTFV10Foundation10URLRequestSbFS2_OS_8Response_VS_4Stub
  Referenced from: /Users/rhan/Library/Developer/Xcode/DerivedData/Surfline-eheubjimlqgiykerufbqqnwywuhs/Build/Intermediates/CodeCoverage/Products/Debug-iphonesimulator/Surfline.app/PlugIns/SurflineTests.xctest/SurflineTests
  Expected in: /Users/rhan/Library/Developer/CoreSimulator/Devices/9C5026F0-B25E-40C1-99FB-0E1F63FAFC3F/data/Containers/Bundle/Application/734A040B-E1D2-45F8-93A4-3ADFA837010B/Surfline.app/Frameworks/Mockingjay.framework/Mockingjay

I'm stuck here. Any hint will be very appreciated.

I think you will need inherit! :search_paths in your test Pod target.

target 'Surfline' do
    pod 'Mockingjay/Core'

    target 'SurflineTests' do
        inherit! :search_paths
        pod 'Mockingjay/XCTest'
    end
end

@trick14 Hi! Did you find any solution? :)