DDMathParser 在使用 CocoaPods 的 Obj-C 项目中不起作用

DDMathParser not working in Obj-C project using CocoaPods

我有一个使用 CocoaPods 的 Obj-C 项目。现在我需要使用用 Swift 编写的 DDMathParser。但无法正确导入 DDMathParser。当我向项目添加新的 Swift 文件时,它工作正常。即使在我创建的 swift 文件中,DDMathParser 也不起作用。这是我的一些代码:

#import "ViewController.h"
#import "test-Swift.h"

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];

    SwiftTest *test = [[SwiftTest alloc] init];
    [test run];

    NSLog(@"%@", [@"5 + 5" numberByEvaluatingString]);

}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end

我必须做什么才能让它发挥作用?

P.S。桥接头已创建并正在运行。在构建设置中 "Defines Modules" 设置为 YES

CocoaPods 文件:

pod 'AFNetworking'
pod 'DDMathParser'
use_frameworks!
pod 'DDMathParser'

这意味着您使用的是 DDMathParser 的 3.0 版,该版本最近在 Swift 中重新编写,其中不存在方法 numberByEvaluatingString。它已重命名为 evaluate.