【发布时间】:2015-07-05 21:39:24
【问题描述】:
我正在努力将其他人编写的 iOS 项目从 Obj C 转换为 Swift。
Obj C 表单中的项目构建和运行良好,并显示它在 x86_64 架构下。
当我尝试在 Swift 中构建时,我收到错误“架构 x86_64 的未定义符号”。消息是:
Undefined symbols for architecture x86_64:
"_DRCollectionViewTableLayoutSupplementaryViewColumnHeader", referenced from:
__TFC13CVTableLayout14ViewController11viewDidLoadfS0_FT_T_ in ViewController.o
__TFC13CVTableLayout14ViewController32collectionViewTableLayoutManagerfS0_FTGSQCSo34DRCollectionViewTableLayoutManager_14collectionViewGSQCSo16UICollectionView_19headerViewForColumnSu9indexPathGSQCSo11NSIndexPath__GSQCSo24UICollectionReusableView_ in ViewController.o
引用的值在 DRCollectionViewTableLayout.h 中定义,位于#import 和 @class 行之间,如下所示:
/**
* Supplementary View kind for column headers
*/
static NSString * const DRCollectionViewTableLayoutSupplementaryViewColumnHeader = @"DRCollectionViewTableLayoutSupplementaryViewColumnHeader";
/**
* Supplementary View kind for row headers
*/
static NSString * const DRCollectionViewTableLayoutSupplementaryViewRowHeader = @"DRCollectionViewTableLayoutSupplementaryViewRowHeader";
我的桥接头文件已经到位,如下所示:
#import "DRCollectionViewTableLayout.h"
#import "DRCollectionViewTableLayoutManager.h"
引用这些常量的我的 viewDidLoad 如下:
override func viewDidLoad() {
super.viewDidLoad()
collectionView.registerClass(UICollectionReusableView.self, forSupplementaryViewOfKind: DRCollectionViewTableLayoutSupplementaryViewColumnHeader, withReuseIdentifier: collectionViewHeaderIdentifier)
collectionView.registerClass(UICollectionReusableView.self, forSupplementaryViewOfKind: DRCollectionViewTableLayoutSupplementaryViewRowHeader, withReuseIdentifier: collectionViewHeaderIdentifier)
collectionView.registerClass(UICollectionViewCell.self, forCellWithReuseIdentifier: collectionViewCellIdentifier)
let collectionViewLayout = DRCollectionViewTableLayout(delegate: self.collectionManager)
collectionViewLayout.horizontalSpacing = 5.0
collectionViewLayout.verticalSpacing = 5.0
collectionView.collectionViewLayout = collectionViewLayout
collectionView.dataSource = collectionManager
collectionView.delegate = collectionManager
}
我的 .m 文件和 .swift 在目标中。
我已经删除了 DerivedData。
我使用的是 xcode 6.3.2
任何想法为什么它不会链接?
【问题讨论】: