【发布时间】:2015-10-15 12:55:46
【问题描述】:
我有一个带有 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
我必须做些什么才能让它发挥作用?
附:桥接头已创建并正在工作。在构建设置中“定义模块”设置为 YES
CocoaPods 文件:
pod 'AFNetworking'
pod 'DDMathParser'
use_frameworks!
【问题讨论】:
-
请添加您的 Cocoapods 文件。
-
还请描述“不起作用”的含义。它无法构建吗?如果是这样,构建失败是什么?它在运行时会失败吗?如果是这样,运行时错误是什么?等等。
-
构建失败。看起来 DDMathParser 的类还没有导入
标签: objective-c xcode swift cocoapods ddmathparser