xcode 链接器找不到 _objc_msgSend 和许多其他符号
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/8349439/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Linker can't find _objc_msgSend and many other symbols
提问by dsafa
So , i have two problems with Xcode . I'm new in the iPhone app development so that any help would be useful . I'm creating an app with a mapView , so first i did everything as it should be . Declaration , view did load , delegates and so on . After that i connected it the property to the map view , and it turned out 28 errors..On the simulator it works , including the map , but on the phone it always breaks . And after that i deleted all the code that's for the map view, it stayed the same .
所以,我有两个 Xcode 问题。我是 iPhone 应用程序开发的新手,因此任何帮助都会有所帮助。我正在创建一个带有 mapView 的应用程序,所以首先我做了所有应该做的事情。声明、视图确实加载、委托等。之后,我将它的属性连接到地图视图,结果出现了 28 个错误。在模拟器上它可以工作,包括地图,但在手机上它总是中断。之后我删除了地图视图的所有代码,它保持不变。
Some ideas what could this be ? how to make a map view for iPhone ?
一些想法这可能是什么?如何为 iPhone 制作地图视图?
"_OBJC_CLASS_$_NSBundle", referenced from:
objc-class-ref in AppDelegate.o
"_OBJC_CLASS_$_NSFileManager", referenced from:
objc-class-ref in AppDelegate.o
"_objc_msgSendSuper2", referenced from:
-[AppDelegate dealloc] in AppDelegate.o
-[MainViewController didReceiveMemoryWarning] in MainViewController.o
-[MainViewController viewDidLoad] in MainViewController.o
-[MainViewController viewDidUnload] in MainViewController.o
-[MainViewController viewWillAppear:] in MainViewController.o
-[MainViewController viewDidAppear:] in MainViewController.o
-[MainViewController viewWillDisappear:] in MainViewController.o
...
"_objc_setProperty", referenced from:
-[AppDelegate setWindow:] in AppDelegate.o
-[MainViewController setManagedObjectContext:] in MainViewController.o
-[MainViewController setOdaberiTaxi:] in MainViewController.o
-[MainViewController setIzbornik:] in MainViewController.o
-[MainViewController setTaxiPicker:] in MainViewController.o
-[MainViewController setListaTaxiZG:] in MainViewController.o
-[MainViewController setToolbar:] in MainViewController.o
...
"__objc_empty_vtable", referenced from:
_OBJC_CLASS_$_AppDelegate in AppDelegate.o
_OBJC_METACLASS_$_AppDelegate in AppDelegate.o
_OBJC_CLASS_$_MainViewController in MainViewController.o
_OBJC_METACLASS_$_MainViewController in MainViewController.o
_OBJC_CLASS_$_FlipsideViewController in FlipsideViewController.o
_OBJC_METACLASS_$_FlipsideViewController in FlipsideViewController.o
"_OBJC_CLASS_$_UIResponder", referenced from:
_OBJC_CLASS_$_AppDelegate in AppDelegate.o
"_objc_msgSend", referenced from:
_main in main.o
-[AppDelegate dealloc] in AppDelegate.o
-[AppDelegate application:didFinishLaunchingWithOptions:] in AppDelegate.o
-[AppDelegate applicationWillTerminate:] in AppDelegate.o
-[AppDelegate saveContext] in AppDelegate.o
-[AppDelegate managedObjectContext] in AppDelegate.o
-[AppDelegate managedObjectModel] in AppDelegate.o
...
"_OBJC_CLASS_$_UIActionSheet", referenced from:
objc-class-ref in MainViewController.o
"_OBJC_CLASS_$_UIViewController", referenced from:
_OBJC_CLASS_$_MainViewController in MainViewController.o
_OBJC_CLASS_$_FlipsideViewController in FlipsideViewController.o
"_objc_autoreleasePoolPop", referenced from:
_main in main.o
"__objc_empty_cache", referenced from:
_OBJC_CLASS_$_AppDelegate in AppDelegate.o
_OBJC_METACLASS_$_AppDelegate in AppDelegate.o
_OBJC_CLASS_$_MainViewController in MainViewController.o
_OBJC_METACLASS_$_MainViewController in MainViewController.o
_OBJC_CLASS_$_FlipsideViewController in FlipsideViewController.o
_OBJC_METACLASS_$_FlipsideViewController in FlipsideViewController.o
"_UIApplicationMain", referenced from:
_main in main.o
"_OBJC_METACLASS_$_UIResponder", referenced from:
_OBJC_METACLASS_$_AppDelegate in AppDelegate.o
"_OBJC_CLASS_$_UIView", referenced from:
objc-class-ref in MainViewController.o
"_OBJC_CLASS_$_UIApplication", referenced from:
objc-class-ref in MainViewController.o
"_OBJC_CLASS_$_NSArray", referenced from:
objc-class-ref in MainViewController.o
"_OBJC_CLASS_$_NSManagedObjectContext", referenced from:
objc-class-ref in AppDelegate.o
"___CFConstantStringClassReference", referenced from:
CFString in AppDelegate.o
CFString in AppDelegate.o
CFString in AppDelegate.o
CFString in AppDelegate.o
CFString in MainViewController.o
CFString in MainViewController.o
CFString in MainViewController.o
...
"_OBJC_CLASS_$_UIAlertView", referenced from:
objc-class-ref in MainViewController.o
"_OBJC_METACLASS_$_UIViewController", referenced from:
_OBJC_METACLASS_$_MainViewController in MainViewController.o
_OBJC_METACLASS_$_FlipsideViewController in FlipsideViewController.o
"_NSSQLiteStoreType", referenced from:
-[AppDelegate persistentStoreCoordinator] in AppDelegate.o
"_objc_autoreleasePoolPush", referenced from:
_main in main.o
"_NSStringFromClass", referenced from:
_main in main.o
"_NSLog", referenced from:
-[AppDelegate saveContext] in AppDelegate.o
-[AppDelegate persistentStoreCoordinator] in AppDelegate.o
"_OBJC_CLASS_$_NSManagedObjectModel", referenced from:
objc-class-ref in AppDelegate.o
"_OBJC_CLASS_$_NSURL", referenced from:
objc-class-ref in MainViewController.o
"_OBJC_METACLASS_$_NSObject", referenced from:
_OBJC_METACLASS_$_AppDelegate in AppDelegate.o
_OBJC_METACLASS_$_MainViewController in MainViewController.o
_OBJC_METACLASS_$_FlipsideViewController in FlipsideViewController.o
"_OBJC_CLASS_$_NSPersistentStoreCoordinator", referenced from:
objc-class-ref in AppDelegate.o
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
采纳答案by rob mayoff
You are missing symbols like __objc_msgSend
which are fundamental parts of the Objective-C runtime. These symbols are found in libobjc.dylib
, which Xcode should link with automatically for any Objective-C project. Furthermore, you're missing symbols from the Foundation framework (e.g. _OBJC_CLASS_$_NSBundle
) and UIKit (e.g. _OBJC_CLASS_$_UIView
). These frameworks are automatically included when you create a new Objective-C project in Xcode.
您缺少像__objc_msgSend
Objective-C 运行时的基本部分这样的符号。这些符号可以在 中找到libobjc.dylib
,Xcode 应该自动链接到任何 Objective-C 项目。此外,您还缺少 Foundation 框架(例如_OBJC_CLASS_$_NSBundle
)和 UIKit(例如_OBJC_CLASS_$_UIView
)中的符号。当您在 Xcode 中创建新的 Objective-C 项目时,这些框架会自动包含在内。
The fact that you are getting these errors indicates that your project is seriously messed up. While it is probably possible for an expert to fix your problem, you probably don't have an expert around.
您收到这些错误的事实表明您的项目严重混乱。虽然专家可能会解决您的问题,但您身边可能没有专家。
So the simplest solution for you is to just create a new project in Xcode and copy your source files over to the new project. And in the new project, be careful not to change or delete build settings unless you understand what they are for. It is easy to accidentally change a build setting, without even realizing it, and start getting inscrutable error messages.
因此,对您来说最简单的解决方案是在 Xcode 中创建一个新项目并将您的源文件复制到新项目中。在新项目中,除非您了解它们的用途,否则请注意不要更改或删除构建设置。很容易意外更改构建设置,甚至没有意识到这一点,并开始收到难以理解的错误消息。
If that doesn't fix your problem, then it is possible that your Xcode installation is damaged, and you may have to reinstall Xcode.
如果这不能解决您的问题,那么您的 Xcode 安装可能已损坏,您可能需要重新安装 Xcode。
回答by DevonDahon
I had a similar error and this solved my problem : Click "TARGETS" > Build Phases >Link Binary With Libraries > Click "+" > CoreData.framework. > Add.
我遇到了类似的错误,这解决了我的问题:单击“目标”>“构建阶段”>“链接二进制与库”> 单击“+”> CoreData.framework。> 添加。