我有一个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
我必须做些什么才能使其正常工作?
PS桥接头已创建并可以使用。在构建设置中,“定义模块”设置为“是”
CocoaPods文件:
pod 'AFNetworking'
pod 'DDMathParser'
use_frameworks!
pod 'DDMathParser'
这意味着您正在使用DDMathParser 3.0版,该版本最近在Swift中重新编写,并且该方法numberByEvaluatingString
不存在。它已重命名为evaluate
。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句