I have an iOS project that has used cocoapods successfully for a few years.
My macbook screen died so I have cloned it to a new macbook temporarily and can no longer build the project. I get a warning for every pod I use along the lines of:
ld: warning: directory not found for option '-L/Users/chris/Library/Developer/Xcode/DerivedData/Bloc-dwchsantxfnowlfgcxthlhtnypue/Build/Products/Debug-iphoneos/AWSCognito'
and an error on the first one:
ld: library not found for -lAWSCognito
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I realise that there are several question similar to this but I have tried most of the answers including: quitting XCode, cleaning the project, pod update, pod install, pod deintegrate, checked I have the latest cocoapods, tried the beta version of cocoapods then reverted to the latest release (1.5.3) (repeated all the above many times in various combinations).
I have done pod init, and the correct target was put in the podfile.
I always launch XCode by double clicking the .xcworkspace not the .xcodeproj file
I have checked that $(inherited) is in the 'Library Search Path' as per this suggestion (though the problem is actually that the libraries are not being generated in the correct place as oppose to not being found there - in fact I dont believe they are being generated at all).
I have deleted the -lPods-Projectname.a under the Frameworks group as per this suggestion (it was red...)
As per the accepted answer here I have:
rm -rf Pods/ Podfile.lock ; pod install
then moved my project.xcworkspace to a backup location, reinstalled cocoapods, rm -rf Pods/ Podfile.lock ; pod install
A curious fact was that having had cocoapods generate the new workspace there was not a scheme for the project (the only scheme on the new macbook was for a library that has been manually added).
My podfile:
# Uncomment the next line to define a global platform for your project
platform :ios, '9.0'
target 'Bloc' do
# Uncomment the next line if you're using Swift or would like to use dynamic frameworks
# use_frameworks!
# Pods for Bloc
pod 'CCBottomRefreshControl'
#pod 'ReactiveCocoa'
pod 'UIView+TKGeometry'
pod 'Branch'
pod 'AWSCognito'
pod 'AWSDynamoDB'
pod 'AWSS3'
pod 'Firebase/Core' #, '~> 4.13.0'
pod 'Firebase/Messaging'
pod 'AppsFlyerFramework'
pod 'TwitterKit', '<3.3.0' # probably 3.2.2
pod 'TwitterCore', '<3.1.0' # probably 3.0.3
pod 'FBSDKCoreKit'
pod 'FBSDKLoginKit'
pod 'FBSDKShareKit'
pod 'QBImagePickerController'
pod 'SDWebImage'
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '9.0'
end
end
end
end
Realising that the problem is the pods not being built, I have looked at my Target Dependencies - there are 0 items. When I attempt to add a dependency there are no pod related ones to add. If I look at the Pods target, it also has 0 dependencies. Here I could add dependencies so selected all the pod library .a files for the libPods-Bloc.a target. I then made a new scheme for libPods-Bloc.a and built it and all the libraries I need were built in the correct place. However I still am unable to add anything to my projects target dependencies to automate building the pods (ie I cant drag the libPods-Bloc.a and it is not in the list to select). libPods-Bloc.a is however in the Linked Frameworks and Libraries
However this does not work fully (and obviously is not a good solution) - the libraries get built and included in my target but I then get a 'Invalid bitcode signature' link error. I have Enable Bitcode set to 0 and my Deployment target is 9.0 and I have the loop in the podfile to set the deployment target to 9.0 for each pod which sorted this problem sometime back.