我有一個Objective-C編寫的iOS應用程序,我想將其轉換爲Swift。根據Apple的Using Swift with Cocoa and Objective-C,我添加了一個新的Swift文件,其名稱與它正在替換的Objective-C類相同,放入一個存根類聲明中,並從目標文件中刪除原始的Objective-C類。將Obj-c iOS應用程序轉換爲Swift時的鏈接程序錯誤
錯誤報道稱,該類的符號不能在鏈接時發現:
Undefined symbols for architecture x86_64:
"_OBJC_CLASS_$_Chunk", referenced from:
objc-class-ref in ViewController.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
這裏是我的stub類的聲明:
import Foundation
@objc class Chunk {
}
有一些連接設置,我可以檢查?
是的,我已經清理了我的項目,刪除了我的派生數據文件夾,並且confirmed that the Swift file is in the Compile Sources section of the Build Phases。
我現在也已經在Xcode 6.1.1中創建了一個全新的項目,並在https://github.com/dpassage/Foo處提供了這個問題。
謝謝,託尼!完全令人困惑的是,更改包含文件修復了*鏈接器*錯誤... – dpassage 2014-11-25 17:38:01
很高興爲您提供幫助! :)「支付!」 – TonyMkenu 2014-11-25 20:59:37