升级到自动引用计数后,我的项目不再编译iOS 5.0模拟器。对于任何iOS设备,它仍可完美编译。
此外,在升级到iOS 5之后,但在升级到自动引用计数之前,我的项目将为设备和模拟器完美编译。
链接器表示无法找到以下符号:
我一开始以为我可能会错过一个模拟器特定的框架,但在添加了每个可用的框架后,我仍然会遇到相同的错误。
Undefined symbols for architecture i386: "_objc_assign_global", referenced from: +[InAppPurchaseManager sharedInAppPurchaseManager] in InAppPurchaseManager.o +[ThemeManager sharedThemeManager] in ThemeManager.o +[DownloadUpdatesManager sharedDownloadUpdatesManager] in DownloadUpdatesManager.o +[AudioManager sharedAudioManager] in AudioManager.o +[IOHelper sharedIOHelper] in IOHelper.o -[CKBezierPath svgStringPath] in CKBezierPath.o +[PreferencesManager defaultLineWidth] in PreferencesManager.o ... "_objc_assign_ivar", referenced from: -[InAppPurchaseManager init] in InAppPurchaseManager.o -[InAppPurchaseManager addTransactionObserver:] in InAppPurchaseManager.o -[InAppPurchaseManager removePurchaseTransactionObserver:] in InAppPurchaseManager.o -[InAppPurchaseManager purchaseProduct:forThemeIDType:] in InAppPurchaseManager.o -[InAppPurchaseManager productsRequest:didReceiveResponse:] in InAppPurchaseManager.o -[ThemeEditVC viewDidLoad] in ThemeEditVC.o -[ThemeEditVC setDelegate:] in ThemeEditVC.o ... "_objc_assign_strongCast", referenced from: +[SFHFKeychainUtils getPasswordForUsername:andServiceName:error:] in SFHFKeychainUtils.o +[SFHFKeychainUtils storeUsername:andPassword:forServiceName:updateExisting:error:] in SFHFKeychainUtils.o +[SFHFKeychainUtils deleteItemForUsername:andServiceName:error:] in SFHFKeychainUtils.o __replacePlaceholdersWithValues in Utility.o -[LocationManager checkForNewLocation:] in LocationManager.o -[LocationManager getNewLocationInStringFormat] in LocationManager.o ___52-[LocationManager getNewLocationInStringFormat]_block_invoke_0 in LocationManager.o ... ld: symbol(s) not found for architecture i386
Objective-C垃圾收集设置为“支持”而不是“必需”。将其设置为“必需”后,我收到错误:
ld:/Users/teacher/drawingapp/FlurryLib/libFlurryAnalytics.a(FlurryAnalytics.o)使用不兼容的垃圾收集设置构建,以便与架构i386的先前.o文件链接 命令/Developer_4_2_ios5/Platforms/iPhoneSimulator.platform/Developer/usr/bin/clang失败,退出代码为1
删除Flurry库后,之前的错误消息再次出现。
看起来垃圾收集只支持OS X而不支持iOS。我仍然不明白为什么它允许我在打开垃圾收集的设备上编译和运行应用程序,但不在模拟器上。
无论如何,我只是将垃圾收集设置为“不支持”,但现在它将不再编译并在设备上运行。
我现在收到此错误:
/Users/teacher/drawingapp/Main/Source/PurchaseThemeOptionVC.m 1. /Users/teacher/drawingapp/Main/Source/PurchaseThemeOptionVC.m:52:1: current parser token '-' 2. /Users/teacher/drawingapp/Main/Source/PurchaseThemeOptionVC.m:39:1: LLVM IR generation of declaration 'PurchaseThemeOptionVC::viewDidLoad' 3. /Users/teacher/drawingapp/Main/Source/PurchaseThemeOptionVC.m:39:21: LLVM IR generation of compound statement ('{}') clang: error: unable to execute command: Segmentation fault clang: error: clang frontend command failed due to signal 2 (use -v to see invocation)
答案 0 :(得分:2)
如果启用垃圾回收,编译器应该只引用这些函数。你确定那些目标文件没有启用垃圾收集编译吗?
答案 1 :(得分:1)
如果启用垃圾收集,编译器应该只引用这些函数
如果要链接与启用垃圾收集编译的库,请不要忘记引用_objc_assign_global/ivar/strongCast
符号。