我和CocoaPods有一个Obj项目。现在我需要使用用Swift编写的DDMathParser。但不能正确导入DDMathParser。当我向项目添加新的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我该怎么做才能让它发挥作用?
创建并工作的桥接标头。在生成设置中,“定义模块”设置为“是”
CocoaPods文件:
pod 'AFNetworking'
pod 'DDMathParser'
use_frameworks!发布于 2015-10-17 00:54:25
pod 'DDMathParser'这意味着您使用的是DDMathParser的3.0版本,它是最近用Swift重新编写的,其中不存在numberByEvaluatingString方法。它被重命名为evaluate。
https://stackoverflow.com/questions/33149164
复制相似问题