Xcode 8 Beta - Convert to Current Swift Syntax Fai

2019-01-16 06:17发布

I am receiving an error message when I try to use Xcode 8's Convert Wizard. After trying rebooting, downloading fresh code, and deleting my DerivedData files I cannot escape this error:

Convert to Current Swift Syntax Failed: Could not find test host

I have tried both options which are: Swift 2.3 and Swift 3. After I select a version I instantly get that error.

Here is a screenshot of the error:

Xcode 8 Convert Error Message

标签: ios xcode xcode8
7条回答
\"骚年 ilove
2楼-- · 2019-01-16 06:42

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

查看更多
Luminary・发光体
3楼-- · 2019-01-16 06:47

+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;
    };
查看更多
等我变得足够好
4楼-- · 2019-01-16 06:49

In my case I deleted my tests target, then re-added it using the + below targets and selecting "iOs Unit Testing Bundle"

For some reason this got a compile error, so I changed the "Per-configuration Intermediate Build Files Path: for my test target to $(PROJECT_TEMP_DIR)/$(CONFIGURATION) for both debug and release. This allowed the compile to work.

查看更多
神经病院院长
5楼-- · 2019-01-16 06:51

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.

查看更多
\"骚年 ilove
6楼-- · 2019-01-16 06:57

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

enter image description here

And run conversion again.

查看更多
手持菜刀,她持情操
7楼-- · 2019-01-16 07:01

Fix this in 3 steps:

  1. First delete your test target
  2. The select Edit -> Convert -> To current Swift syntax... and perform the conversion
  3. Then add a new test target
查看更多
登录 后发表回答