Ios 将swift类导入到objective c脚本中
我正在尝试将这个项目整合到我的目标c项目中 我有一个Xcode自动为我制作的objc桥接头 我翻译了ViewController.swift代码Ios 将swift类导入到objective c脚本中,ios,objective-c,swift,storyboard,interface-builder,Ios,Objective C,Swift,Storyboard,Interface Builder,我正在尝试将这个项目整合到我的目标c项目中 我有一个Xcode自动为我制作的objc桥接头 我翻译了ViewController.swift代码 UIStoryboard *sb = [UIStoryboard storyboardWithName:@"Walkthrough" bundle:nil]; BWWalkthroughViewController *walkthrough = [sb instantiateViewControllerWithIdentifier:@"walk"];
UIStoryboard *sb = [UIStoryboard storyboardWithName:@"Walkthrough" bundle:nil];
BWWalkthroughViewController *walkthrough = [sb instantiateViewControllerWithIdentifier:@"walk"];
BWWalkthroughPageViewController *page_zero = [sb instantiateViewControllerWithIdentifier:@"walk0"];
BWWalkthroughPageViewController *page_one = [sb instantiateViewControllerWithIdentifier:@"walk1"];
BWWalkthroughPageViewController *page_two = [sb instantiateViewControllerWithIdentifier:@"walk2"];
BWWalkthroughPageViewController *page_three = [sb instantiateViewControllerWithIdentifier:@"walk3"];
walkthrough.delegate = self;
[walkthrough addViewController:page_zero];
[walkthrough addViewController:page_one];
[walkthrough addViewController:page_two];
[walkthrough addViewController:page_three];
[self presentViewController:walkthrough animated:YES completion:nil];
我像这样导入swift类:
导入“SkipTheLine Swift.h”
我的桥接头文件的名称是“SkipTheLine bridgeing header.h”
现在,当我运行代码时,我得到了
2015-04-25 16:47:46.740 SkipTheLine[1631:215786]接口生成器文件中未知类BWWalkthroughViewController。
2015-04-25 16:47:46.754 SkipTheLine[1631:215786]-[UIViewController setDelegate:]:发送到实例0x12651cf90的选择器无法识别
2015-04-25 16:47:46.755 SkipTheLine[1631:215786]*由于未捕获的异常“NSInvalidArgumentException”而终止应用程序,原因:'-[UIViewController setDelegate:]:未识别的选择器发送到实例0x12651cf90'
*第一次抛出调用堆栈:
(0x1838AA5300x19482C0E4 0x1838b15f4 0x1838ae3ac 0x1837b2c4c 0x10009c494 0x1880eca14 0x1880d5d08 0x1880ec3b0 0x1880ec03c 0x1880e5590 0x1880b8e60 0x18835846c 0x1880b73d0 0x183862d34 0x183861fd8 0x183860088 0x18378d1f4 0x18CB76FC 0x18811e10c 0x10009e174 0x194EA08)
libc++abi.dylib:以NSException类型的未捕获异常终止
关于如何在interface builder中使用swift代码,有什么想法吗?我想出来了
您只需将interface builder中的模块编辑为项目名称 在使用CocoaPods集成BWWalkthrough时,将模块名设置为BWWalkthrough对我来说很有效。