Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xcode 8 Beta - Convert to Current Swift Syntax Failed: Could not find test host

Tags:

xcode

ios

xcode8

This worked for me:

  1. Select the Xcode project in the lefthand browser.
  2. Click on your test target in the Project's General tab.
  3. Disclose "Testing". In my project the "Host Application" pulldown button was blank. Select your appropriate host application.
  4. Try building your test target now. If that succeeds then converting syntax should as well.

I had this problem after installing the Xcode 8 beta so I assume this is related.

Picture Credit to @karthikkck enter image description here


It cost me a bit of time to find the "Host Application" pulldown mentioned in the otherwise very helpful answer by iluvcapra.

So this is what he meant:

This is where you find the pulldown menu. Select your main target.

This is where you find the pulldown menu


I find easy fix for this, just edit your Scheme and disable tests.

enter image description here

And run conversion again.


+1 iluvcapra

Alternatively, use text editor to remove the following two items from your MyAppSwift.xcodeproj/project.pbxproj file, search for TEST_HOST

Now, re-open your project and run the convert wizard again.

    4EFFFAE51B53D5D8003CD25A /* Debug */ = {
        isa = XCBuildConfiguration;
        buildSettings = {
            BUNDLE_LOADER = "$(TEST_HOST)";
            FRAMEWORK_SEARCH_PATHS = (
                "$(SDKROOT)/Developer/Library/Frameworks",
                "$(inherited)",
            );
            GCC_PREPROCESSOR_DEFINITIONS = (
                "DEBUG=1",
                "$(inherited)",
            );
            INFOPLIST_FILE = "AF SwiftTests/Info.plist";
            LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
            PRODUCT_NAME = "FA SwiftTests";
            TEST_HOST = "$(BUILT_PRODUCTS_DIR)/AF Swift.app/AF Swift";
        };
        name = Debug;
    };
    4EFFFAE61B53D5D8003CD25A /* Release */ = {
        isa = XCBuildConfiguration;
        buildSettings = {
            BUNDLE_LOADER = "$(TEST_HOST)";
            FRAMEWORK_SEARCH_PATHS = (
                "$(SDKROOT)/Developer/Library/Frameworks",
                "$(inherited)",
            );
            INFOPLIST_FILE = "AF SwiftTests/Info.plist";
            LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
            PRODUCT_NAME = "FA SwiftTests";
            TEST_HOST = "$(BUILT_PRODUCTS_DIR)/AF Swift.app/AF Swift";
        };
        name = Release;
    };

enter image description here

Please try these Steps:

  1. Select your project on the left side of Xcode.
  2. Go to Targets and select your Project Tests.
  3. Select the General Tab and select Host Application drop down and choose your Host Application.
  4. Convert or Run your project.

Trying these steps worked for me.