2012-09-26 26 views
6

我是iphone開發和phonegap的新手。現在我想用phonegap創建簡單的iphone應用程序。現在我在獅子蘋果機上使用phonegap2.0。我的Xcode版本是4.3。現在我的問題是在xcode中安裝phonegap2.0之後,當我在我的模擬器5.0中運行Xcode時。我得到了這個錯誤。

"Undefined symbols for architecture i386: 
    "_OBJC_CLASS_$_CDVViewController", referenced from: 
     _OBJC_CLASS_$_ViewController in ViewController.o 
     objc-class-ref in AppDelegate.o 
    "_OBJC_METACLASS_$_CDVViewController", referenced from: 
     _OBJC_METACLASS_$_ViewController in ViewController.o 
ld: symbol(s) not found for architecture i386 
clang: error: linker command failed with exit code 1 (use -v to see invocation)" 

請幫我解決這個問題。提前致謝。 而且我附上錯誤頁面的屏幕截圖供您參考。 enter image description here

回答

13

檢查您的項目是否鏈接libCordova.a(在我的情況下,當將CordovaLib.xcodeproj移動到另一個位置時,Xcode忘記了引用。

  • 選擇在項目導航
  • 項目轉到摘要標籤
  • CordovaLib.xcodeproj > Products > libCordova.a鏈接的框架和庫

enter image description here

清潔&構建。

3

請檢查您的ViewController.m文件,並轉到以 1.構建階段在Xcode 2.選擇編譯源代碼 3.按+按鈕可添加的.m/.mm文件

我認爲這將現在成功運行

+0

嗨。感謝您的回覆。但它顯示了另一個錯誤。 – kannan

+0

錯誤是什麼? – Saif

+1

「爲架構的ARMv6未定義的符號: 「_OBJC_CLASS _ $ _ CDVViewController」,從引用: _OBJC_CLASS _ $ _的ViewController在ViewController.o objc級,裁判在AppDelegate.o 「_OBJC_METACLASS _ $ _ CDVViewController」,從引用: _OBJC_METACLASS _ $ _的ViewController在ViewController.o ld:未找到架構armv6的符號 clang:錯誤:鏈接器命令失敗,退出代碼1(使用-v查看調用)「 – kannan

2

從您的構建設置中刪除armv7s,對於您的項目和引用的子項目Cordova。將你的目標設定爲4.3。

0

我有類似的問題。不知何故,我的Core Data實體的NSManagedObject子類在Compile Sources表中兩次。當它碰到這些重複的第一個時,編譯器會窒息。

我剛進入Compile Sources表並刪除了第二個出現的每個.m列表。