由于某些原因,当我添加' - ObjC'时,我收到链接器错误到我的Xcode项目中的其他链接器标志。如果我删除此标志,我将无法加载其中一个表视图并收到以下错误:
*** Assertion failure in -[AMTableView _configureCellForDisplay:forIndexPath:], /SourceCache/UIKit_Sim/UIKit-3318.16.14/UITableView.m:7344
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'UITableView dataSource must return a cell from tableView:cellForRowAtIndexPath:'
我是否相信这是由缺乏-ObjC引起的?
所以当我重新添加标志时(它实际上是用 - $(继承)引入的,因为cocoapods告诉我把它带进去),我得到一个链接器错误:
Ld /Users/jimmy/Library/Developer/Xcode/DerivedData/AptTin-anlnlphskgbkbydlukhsoqjapwpl/Build/Products/Debug-iphonesimulator/myapp.app/myapp normal x86_64
cd /Users/jimmy/Desktop/AptTin
export IPHONEOS_DEPLOYMENT_TARGET=8.1
export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator8.1.sdk -L/Users/jimmy/Library/Developer/Xcode/DerivedData/AptTin-anlnlphskgbkbydlukhsoqjapwpl/Build/Products/Debug-iphonesimulator -F/Users/jimmy/Library/Developer/Xcode/DerivedData/AptTin-anlnlphskgbkbydlukhsoqjapwpl/Build/Products/Debug-iphonesimulator -F/Users/jimmy/Desktop/AptTin -filelist /Users/jimmy/Library/Developer/Xcode/DerivedData/AptTin-anlnlphskgbkbydlukhsoqjapwpl/Build/Intermediates/AptTin.build/Debug-iphonesimulator/AptTin.build/Objects-normal/x86_64/myapp.LinkFileList -Xlinker -objc_abi_version -Xlinker 2 --ObjC -lPods-AFNetworking -lPods-AMSlideOutController -lPods-DACircularProgress -lPods-HexColors -lPods-LBBlurredImage -lPods-MBProgressHUD -lPods-MWPhotoBrowser -lPods-PSTCollectionView -lPods-SDWebImage -lPods-TSMessages -framework Accelerate -framework AssetsLibrary -framework CoreGraphics -framework ImageIO -framework MapKit -framework MessageUI -framework MobileCoreServices -framework QuartzCore -framework Security -framework SystemConfiguration -framework UIKit -fobjc-arc -fobjc-link-runtime -Xlinker -no_implicit_dylibs -mios-simulator-version-min=8.1 -framework MobileCoreServices -framework Security -framework CoreLocation -framework SystemConfiguration -framework AssetsLibrary -framework MessageUI -framework ImageIO -framework CoreData -framework MapKit -framework QuartzCore -framework Crashlytics -framework CoreGraphics -framework FacebookSDK -framework UIKit -framework Foundation -lPods -Xlinker -dependency_info -Xlinker /Users/jimmy/Library/Developer/Xcode/DerivedData/AptTin-anlnlphskgbkbydlukhsoqjapwpl/Build/Intermediates/AptTin.build/Debug-iphonesimulator/AptTin.build/Objects-normal/x86_64/myapp_dependency_info.dat -o /Users/jimmy/Library/Developer/Xcode/DerivedData/AptTin-anlnlphskgbkbydlukhsoqjapwpl/Build/Products/Debug-iphonesimulator/myapp.app/myapp
clang: error: unsupported option '--ObjC'
我错过了什么? --ObjC标志究竟发生了什么?
答案 0 :(得分:2)
问题是链接器标志的拼写错误。我刚刚检查了我的项目,它应该是' -ObjC'一个短划线,但不是两个。
以下是有关旗帜的其他信息:
https://developer.apple.com/library/ios/qa/qa1490/_index.html
这是Apple的描述:
将-ObjC选项传递给链接器会导致它加载所有成员 实现任何Objective-C类或类别的静态库。 这将拾取任何类别方法实现。但它可以做到 结果可执行文件更大,并可能拾取不必要的对象。 因此,默认情况下不启用