Xcode can't archive project with cocoapods - ios

I have problem with creating Archive of my project. When I try build and run project on devices it's working okay. But when I tried to archive project for distribution I have problem. It takes some time and it's doing all work but at the end I gives me error:
ld: library not found for -lPods-[project]-ZXingObjC
clang: error: linker command failed with exit code 1 (use -v to see invocation)
My Podfile:
platform :ios, '8.0'
use_frameworks!
def shared_pods
pod 'ZXingObjC'
pod 'Fabric'
pod 'Crashlytics'
end
target '[project]' do
shared_pods
end
target '[project]Tests' do
end
target '[project]Demo' do
shared_pods
end
What I've tried:
Restart Xcode
Restart OSX
Remove and add Cocoapods
Check settings for Build Active Architecture Only (it's same for my project and Pods project)
Check Build Setting > Other Linker Flag
Change scheme for Archive from Release to Debug
Try archive with iOS Device or two real devices
Disable paralelize builds in Scheme -> Build
Check http://guides.cocoapods.org/using/troubleshooting.html
Project settings -> Info tab –> Configuration sets
and maybe more. I've tried to search questions here and tried google but for now nothing help. I am now downloading Xcode 7 but I don't think it help. So where could be problem? Why it's not archiving project? Thanks for any help or idea

I ran into the same issue today, and the problem is in use_frameworks!. Remove it and you'll be able to archive your project.
But you could run into other problem, if your pods have some namespace conflicts.

Archive button is only available when you build on real device. Try it on a real device instead of simulating it.

Related

Cocoapods causing "library not found" and header "file not found" errors for Xcode Simulator but not device

I'm using Cocoapods with my Xcode project, but it seems to be causing both "library not found" and header "file not found" errors when building with the Simulator but not when I have a device connected nor when using "Generic iOS Device".
My Podfile is simple. I have only one pod in there, for Microsoft's ADAL SDK, needed for single sign-on. When I use use_frameworks! in the Podfile I get:
fatal error: 'ADAL/ADAL.h' file not found
for the line
#import <ADAL/ADAL.h>
but if I use use_modular_headers! instead of use_frameworks! I get:
ld: warning: directory not found for option '-L/Users/memyself/Documents/iOS_Projects/ASSIST-main/ASSIST-main/DerivedData/MyApp/Build/Products/Debug-iphonesimulator/ADAL'
ld: library not found for -lADAL
Even if I disable both of those it builds fine for the device and for "Generic iOS Device", but fails with 'ADAL/ADAL.h' file not found error.
Yes, there are plenty of SO questions and answers for those kinds of errors (such as here) but no success trying them. To be specific, I'm using $(inherited) in the recommended search paths, setting enable bitcode to NO, making sure I'm opening the xcworkspace not the xcodeproj file, and have tried
$ pod deintegrate
$ pod clean
$ rm Podfile
Also, my app uses AWS and Firebase and I was getting the same problem with them, but was able to fix them by manually adding the necessary frameworks. However, I don't have a framework for ADAL, and frankly I need to fix this so I can use Cocoapods to install and manage my AWS and Firebase dependencies. It is very suspicious that it only fails when building for the Simulator, what project settings could cause this?
Update the deployment target and the Podfile 'platform' target. Update both from 9.0 to 11.0. Change this line in your Podfile
platform :ios, '11.0'
and this in both your Target and Project:
Try changing build active architecture only in build settings.

Can't archive react-native project in XCode for staging configuration with Pods

react-native: 0.50.3
xcode: 9.1 (9B55)
I have 3 configuration:
Default
Stage
Production
In 1 and 3 Product > Archive is working fine. When I try to archive Stage, I got an error:
ld: library not found for -lPods-carrier_mobile_app
This error appears after adding Pods in my project. Podfile looks like
platform :ios, '8.0'
target 'carrier_mobile_app' do
# Pods for carrier_mobile_app
pod 'RSKImageCropper'
pod 'QBImagePickerController'
end
I think I should configure Pods for Stage configuration correct. Any ideas?
Referring to this here: https://medium.com/#guyeldar/setting-up-multiple-build-configurations-for-your-xcode-project-c237265e8324
Theoretically adding $(BUILD_DIR)/Release$(EFFECTIVE_PLATFORM_NAME) to your Header, Framework, and Library search paths in your targets will work. However, it only worked one time for me, then I accidentally changed something, and it hasn't been working since. Worth a shot, though.

"No such module 'Alamofire'" Xcode won't recognize Alamofire framework

I realize that the same error was asked in other questions (like here), but their solutions are not working for me.
I keep getting a build failure in my app: "No such module 'Alamofire'". I followed the cocoadocs installation instructions (here) for installing Alamofire and it still is not working. I made sure everything has the same deployment target.
Embedded Binaries and Frameworks
Here's my podfile text.
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, ‘9.2’
use_frameworks!
target 'MyApp' do
pod 'Alamofire', '~> 3.0'
end
target 'MyAppTests' do
end
target 'MyAppUITests' do
end
Also, I tried "$ pod install" again in Terminal and got this message:
[!] The `App [Debug]` target overrides the `EMBEDDED_CONTENT_CONTAINS_SWIFT` build setting defined in `Pods/Target Support Files/Pods-App/Pods-App.debug.xcconfig'. This can lead to problems with the CocoaPods installation
- Use the `$(inherited)` flag, or
- Remove the build settings from the target.
After following Sohil's suggestions, XCode now recognizes the Alamofire module, but 22 new issues have arisen.
Update #2: So I'm now on Xcode 7.3 and Swift 2.2, but I'm receiving a new error with the workspace Link: "ld: framework not found Alamofire. clang: error: linker command failed with exit code 1 (use -v to see invocation)."
Do the following things and you can import any swift file from "Pods"
1) Clean your project
2) Make sure that all your "Pods" > "Build Settings" > "Build Active
Architecture Only" is set to "NO".
3) Don't run, just build your project.
4) Now, import any file from "Pods" to any swift file
E.g.: import Alamofire
5) Again, build project and it will work as expected. Finally, you can
access it properties
Update:
For the updated question, I hope you are using Xcode 7.3 so please update the Alamofire to Swift 2.2
Hope this helps!
Please check this screenshot
and compare to your build setting
may this is helpful to you
For me the solution was to open the "App".xcworkspace as pointed by the cocoapods documentation
The steps was:
Close project
Close xcode
Go to terminal
type "open |App|.xcworkspace"
When I opened Xcode it was still pointing the error then I built the project (cmd+b) and everything is fine now.
The target overrides the OTHER_LDFLAGS build setting.
Use the $(inherited) flag in TARGENTS -> Build Settings -> Framework Search Paths
in my case, i couldn't run archive after change bundle name. I've cleaned build folder and run pod install then everything worked fine.

GoogleMaps target doesn't get created in Pods project

System information: Xcode 7.0.1 w/ iOS 9
The issue i am having is: After adding the GoogleMaps pod (1.10.3) to my podfile, the application builds in Xcode for the iOS Simulator, but not for a device.
The error that occurring is as follows:
ld: '/Users/<username>/Projects/Arsenal/LitterBug/Pods/GoogleMaps/Frameworks/GoogleMaps.framework/GoogleMaps(GMSCachedTile.o)' does not contain bitcode. You must rebuild it with bitcode enabled (Xcode setting ENABLE_BITCODE), obtain an updated library from the vendor, or disable bitcode for this target. for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Every post I have found mentions setting the ENABLE_BITCODE flag to 'No' for the pod target in the Pods project. That would be a viable option, if only to allow development to continue until Google updates the SDK, if the GoogleMaps target was being created in the Pods project.
My current podfile looks like:
source 'https://github.com/CocoaPods/Specs.git'
use_frameworks!
target 'AppName' do
pod "Parse"
pod "SwiftOverlays"
pod "FBSDKCoreKit"
pod "GoogleMaps"
pod "FBSDKLoginKit"
pod "FBSDKShareKit"
end
target 'AppNameTests' do
end
When i run pod install --verbose or pod update --verbose, the 'install targets' phase appears to NOT install the GoogleMaps target in the Pods project. This is indeed confirmed by viewing the project in the workspace.
There IS a target created along-side the other pod targets called 'Pods-appname'. I've tried disabling bitcode for this target, but it did not fix the issue.
If anyone else has experienced this issue, please let me know. The original error i received is currently being tracked as an issue and can be viewed here: GoogleMaps issue 8219
The current workaround requires a GoogleMaps target existing in the Pods project in the workspace.
I solved this problem by Setup Enable Bitcode = NO in Build Settings.
Project>Build Settings>All>Build Options>Enable Bitcode = NO
Just select Pods in PROJECT and set Use Legacy Swift Language Version to YES.

Cocoapods Completely Broke

To start: I'm using Cocoapods 0.37.2, XCode 6.3.1 compiling for iOS 8.3
My project worked just fine before I ran a basic "pod update" now it's completely refusing to compile. I'm quite positive this has nothing to do with the pods themselves. Specifically the error I'm getting is this:
ld: warning: directory not found for option '-F/Users/user_name/Library/Developer/Xcode/DerivedData/AppName-bjozswzeepmhacfkeimeepxzcxgb/Build/Products/Debug-iphoneos/include'
ld: library not found for -lPods-AppName-AFNetworking
Podfile is this:
# Uncomment this line to define a global platform for your project
platform :ios, "8.0"
def shared_pods
pod 'SocketRocket'
pod 'AFNetworking'
pod 'DateTools'
pod 'Spotify-iOS-SDK'
end
target "AppName" do
shared_pods
end
target "AppNameTests" do
shared_pods
end
I have cleared DerivedData (many many times), cleaned my builds, restarted XCode, restarted my machine, I have ensured my config files and linker config lists are set up correctly. I've been using Cocoapods for years and never had this much trouble.
Completely frustrated and confused... questioning sanity.
Any help?
Information from CocoaPods troubleshooting doc. Hope this helps you.
If Xcode complains when linking, e.g. Library not found for -lPods, it
doesn't detect the implicit dependencies:
Go to Product > Edit Scheme
Click on Build
Add the Pods static
library, and make sure it's at the top of the list
Clean and build again
If that doesn't work, verify that the source for the spec you
are trying to include has been pulled from GitHub. Do this by looking
in /Pods/. If it
is empty (it should not be), verify that the
~/.cocoapods/master//.podspec has the correct git hub url
in it.
If still doesn't work, check your Xcode build locations
settings. Go to Preferences -> Locations -> Derived Data -> Advanced
and set build location to "Relative to Workspace".

Resources