Ios 从目标c调用swift函数会导致链接器错误

Ios 从目标c调用swift函数会导致链接器错误,ios,swift,swift3,Ios,Swift,Swift3,我试图从目标c文件调用swift函数 快速功能实施: @objc class FXFormVariables : NSObject { class func FXFontName() -> String { return fontName } class func FXFontSize() -> CGFloat { return fontSizeLarge } class func FXHiddenCell() -> NSArray { return h

我试图从目标c文件调用swift函数

快速功能实施:

@objc class FXFormVariables : NSObject {
    class func FXFontName() -> String { return fontName }
    class func FXFontSize() -> CGFloat { return fontSizeLarge }
    class func FXHiddenCell() -> NSArray { return hiddenElementFromFormIndex as NSArray }
}
目标C:

NSArray *hideArray = [FXFormVariables FXHiddenCell];
if ([hideArray containsObject:@(cellIndexPath)]){
        return 0.0;
}
构建时中的链接器错误:

 Undefined symbols for architecture x86_64:
  "_OBJC_CLASS_$__TtCC13Social_Engine11AppDelegate15FXFormVariables", referenced from:
      objc-class-ref in FXForms.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
这段代码在Xcode 7.3中运行良好,但升级到8.3后,它开始抛出链接器错误


请帮忙。提前感谢。

导入名为Project name的文件,并在Objective-C文件中添加-Swift.h

请检查下面的导入文件示例

#import “ProjectName-Swift.h”
当您使用.swift文件构建项目时,Xcode将生成此文件

此外,您可以从以下问题中进行检查:

导入名为Project name的文件,并在Objective-C文件中添加-Swift.h

请检查下面的导入文件示例

#import “ProjectName-Swift.h”
当您使用.swift文件构建项目时,Xcode将生成此文件

此外,您可以从以下问题中进行检查:

您可以获得这种类型的错误检查。您的类列在目标的“构建阶段”选项卡的“编译源代码”步骤下。通常Xcode会为您执行此操作,但有时它会丢失绘图,您需要手动添加类文件

为此:


TargetSettings->Build Phases->Compile Sources->add your class-.swift>Build and Run

您可以获得此类错误检查您的类列在目标“Build Phases”选项卡的“Compile Sources”步骤下。通常Xcode会为您执行此操作,但有时它会丢失绘图,您需要手动添加类文件

为此:


TargetSettings->Build Phases->Compile Sources->add your class-.swift>构建并运行

我已经包含了该文件。我已经包含了该文件。