Reputation: 13
For test purposes, I created a new project in Xcode as a Command Line tool (Test), added a dylib target called Networking.
Ran the following commands
pod init In the pod file, under the Networking Target, Removed use_frameworks! added pod 'AFNetworking', '~> 2.0'
pod install
After Installation, In BuildPhases of Test CLI, I added Networking dylib. Created a simple method to call AFHTTPRequestOperationManager to test out. Called this method from TestCLI by Importing Networking.h
From Xcode it builds just fine, even archive works just fine from Xcode but when I try to archive from the following command line
xcodebuild -scheme Test -configuration Production archive -archivePath Test.xcarchive
I get the following error
ld: library not found for -lAFNetworking
The following build commands failed: Ld /Users/user/Library/Developer/Xcode/DerivedData/Build/Intermediates.noindex/ArchiveIntermediates/Test/InstallationBuildProductsLocation/usr/local/lib/libNetwork.dylib normal x86_64 (1 failure)
Any ideas why ?
Upvotes: 1
Views: 153
Reputation: 331
Try making your build command:
xcodebuild -workspace Test.xcworkspace -scheme Test -configuration Production archive -archivePath Test.xcarchive
I think if you don't specify the workspace setting, xcodebuild would be trying to use your project, which would not contain any Pods or the paths needed for linking.
Upvotes: 1