Reputation: 1461
For some reason I am getting a linker error when I add '--ObjC' to my Other Linker Flags in my Xcode project. If I remove this flag, I am not able to load one of my table views and get the following error:
*** 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:'
Am I right in believing this is caused by the lack of --ObjC?
So when I add the flag back in (its actually being pulled in with -$(inherited), because cocoapods told me to bring it in), I get a linker error:
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'
What am I missing? What exactly happens with the --ObjC flag?
Upvotes: 0
Views: 707
Reputation: 8215
The issue is incorrect spelling of linker flag. I've just checked in my project, it should be '-ObjC' with one dash, but not two.
Here is additional information about the flag:
https://developer.apple.com/library/ios/qa/qa1490/_index.html
This is description from Apple:
Passing the -ObjC option to the linker causes it to load all members of static libraries that implement any Objective-C class or category. This will pickup any category method implementations. But it can make the resulting executable larger, and may pickup unnecessary objects. For this reason it is not on by default
Upvotes: 2