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

Could not find auto-linked framework #114

Open
christinasund opened this issue Jun 28, 2019 · 5 comments
Open

Could not find auto-linked framework #114

christinasund opened this issue Jun 28, 2019 · 5 comments

Comments

@christinasund
Copy link

I have successfully installed via Cocoapods, imported the module in my XCTest class, and added methods. When I try and run my tests I see the below error. I have tried to import the project manually with no luck, have the framework in my linked frameworks for the test target. Any ideas?

image

Thanks

@kylef
Copy link
Owner

kylef commented Jun 28, 2019

@christinasund are you able to share your Podfile (or atleast the important parts, you can redact target names and remove other dependencies). I'd check that Mockingjay is inside the test target itself, for example:

source 'https://github.com/CocoaPods/Specs'

use_frameworks!
inhibit_all_warnings!

target 'Palaver' do
  pod 'PalaverKit', :git => 'https://github.com/kylef/PalaverKit.git'
  pod 'Bugsnag'
  pod 'Commander'

  target 'PalaverTests' do
    inherit! :search_paths

    pod 'Mockingjay', '3.0.0-alpha.1'
  end
end

@christinasund
Copy link
Author

christinasund commented Jun 28, 2019

@kylef Yes, no problem. I have added Mockingjay to the test target only

# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'

target 'ios' do
  # Comment the next line if you don't want to use dynamic frameworks
  use_frameworks!

  # Pods for ios

end

target 'macOS' do
  # Comment the next line if you don't want to use dynamic frameworks
  use_frameworks!

  # Pods for macOS

end

target 'OSXTestHost' do
  # Comment the next line if you don't want to use dynamic frameworks
  use_frameworks!

  # Pods for OSXTestHost

end

target 'SwiftTestbed' do
  # Comment the next line if you don't want to use dynamic frameworks
  use_frameworks!

  # Pods for SwiftTestbed

end

target 'TestHost' do
  # Comment the next line if you don't want to use dynamic frameworks
  use_frameworks!

  # Pods for TestHost
  pod 'Mockingjay'
end

@kylef
Copy link
Owner

kylef commented Jun 28, 2019

This can depend a bit on the configuration of your project, it may be that TestHost is an application which has a separate test target (perhaps TestHostTests) which is injected into it.

Perhaps we can confirm that with getting a full list of the targets, for example:

$ xcodebuild -list
Information about project "Palaver":
    Targets:
        Palaver
        PalaverTests
        PalaverUITests

You may need to pass -workspace <filename for xcode workspace>.

@christinasund
Copy link
Author

I think you might be right, but I do not see this other test target in my Podfile, what do you suggest?

Information about project "swift":
    Targets:
        swift-tests-ios
        swift-tests-osx
        swift-tests-tvos
        ios
        tvos
        watchOS
        macOS
        TestHost
        OSXTestHost
        TVOSTestHost
        swift-tests-ios-crash
        SwiftTestbed
        Core
        AppData
        Attribution
        Autotracking
        Collect
        Connectivity
        ConsentManager
        Crash
        DataSource
        DefaultsStorage
        Delegate
        DeviceData
        DispatchQueue
        FileStorage
        Lifecycle
        Logger
        RemoteCommands
        TagManagement
        VolatileData
        VisitorProfile

    Build Configurations:
        Debug
        Release

    If no build configuration is specified and -scheme is not passed then "Release" is used.

    Schemes:
        ios
        macOS
        OSXTestHost
        SwiftTestbed
        swift-tests-osx
        swift-tests-tvos
        AppData
        Attribution
        Autotracking
        Collect
        Connectivity
        ConsentManager
        Core
        CrashModule
        DataSource
        DefaultsStorage
        Delegate
        DeviceData
        DispatchQueue
        FileStorage
        Lifecycle
        Logger
        RemoteCommands
        TagManagement
        VisitorProfile
        VolatileData
        TestHost
        tvos
        TVOSTestHost
        watchOS

@kylef
Copy link
Owner

kylef commented Jul 1, 2019

I think you could see what it hooked up in the scheme, it might show you which test target is injected into a host app scheme:

On the top menu:

  • Product -> Scheme -> Select Scheme (TestHost)
  • Product -> Scheme -> Edit Scheme, then select the "test" tab on left side.

Screenshot 2019-07-01 at 10 40 03

In the reverse, you can see which target is put into which host application using the project/target views of Xcode:

Screenshot 2019-07-01 at 10 43 53

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

No branches or pull requests

2 participants