Integration error with Cocoapods and XCode5 - cocoapods

When building my project in the new XCode5, I receive the following warning: Pods-App was rejected as an implicit dependency for 'libPods-App.a' because its architectures 'i386' didn't contain all required architectures 'x86_64'.

To fix that, select the Pods project in the left menu, then under the targets section select the Pods-#YourAppName# target and in the build settings click on the Architectures and press delete so it goes to the default option (Standard architectures (armv7, armv7s). More information can be found in this link.

Non of the other answers worked for me.
What eventually solved it for me is to make sure Build Active Architecture Only is set to Yes for Debug and No for Release in my app's xcodeproj file.
Also, because I have custom configurations, I had to add the following to the Podfile:
xcodeproj 'MyApp.xcodeproj', 'MyDebugConfiguration' => :debug, 'MyReleaseConfiguration' => :release

Take a look at the blog post here, it will do the work.
To make your Applications compatible for iPhone 5s and older models (till iPhone 3Gs running iOS6), select the following option for your architectures – “Standard Architectures – armv7, armv7s”. Do not select the option that says “Standard Architectures (including 64 bit)…”. Since the Arm instruction sets are backward compatible, any application compiled for armv7s will also run on the iPhone 5s or the iPhone 5c.
ARCHS = armv7 armv7s
For valid architectures in the build settings, you can specify arm64,
armv7, armv7s.
VALID_ARCHS = armv6 armv7 armv7s arm64

env:
CocoaPods v0.24.0
Xcode 5 from App Store
Add the following at the end of your Podfile.
post_install do |installer|
installer.project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['ARCHS'] = "$(ARCHS_STANDARD_INCLUDING_64_BIT)"
end
end
end

Go to Project "pods", set "build active architecture only" to NO for debug.
Above solution is working for me.

I have just upgraded one of my projects to Xcode 6 and experienced this problem. To fix it, I changed the Base SDK of the Pods project to a real one (previously it was like unknown SDK).

I had this same issue. The warning suggested that the pod library was not included and as a result, the app failed to finish compiling. (It complained about a missing header file that was part of a Pod dependency).
If you are experiencing the same compilation issue, you might be able to resolve it with the following:
Select Pods project in the workspace
Select Pods project to
access Pods project-wide settings
Go to Build Settings
Search
for 'Build Active Architecture Only'
Set to 'NO'
This seemed to work for me, but YMMV.

Related

Could not find module RevenueCat after upgrading to new M1 Mac Pro? [duplicate]

I am getting rid of my 8 year old mac, and am switching to the new m1 macbook air, but none of my old projects are running. I have installed cocoapods succesfully, but a lot of my big projects are running into errors, even after updating all the pods and running everything through Rosetta. Here are some of the errors I am running into in Xcode:
Could not find module 'PodName' for target
'x86_64-apple-ios-simulator'; found: arm64, arm64-apple-ios-simulator
No such module 'PodName'
These are just a few, encountering many errors. I tried updating these pods, reinstalling them, etc. but nothing is working. Has anyone with a m1 mac had any success with this?
You can tweak your project architecture or add the following at the very end of your Podfile (and run pod update again) :
post_install do |installer|
installer.pods_project.build_configurations.each do |config|
config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
end
end
This seems likely related to this question & answer here: Xcode 12, building for iOS Simulator, but linking in object file built for iOS, for architecture arm64
Basically what you'll need to do is make sure that:
The architectures being built is set to Standard Architectures (ARCHS_STANDARD)
That you add an 'excluded' architecture setting, for Any iOS Simulator and set it to arm64
That should get you up and running.
One thing to note (that caught me up for a while): Make sure that you do not have the Build Setting of "Valid Architectures" (VALID_ARCHS). If you do, delete the line entirely. It was causing issues for me, because it was effectively ignoring the new paradigm that Apple wants us to use (Architectures + Excluded Architectures).
Finally, if you do not see VALID_ARCHS but you're still unable to run it, one thing that worked for me (since I also was coming back to an old project) was to:
Add in VALID_ARCHS and set it to Standard architectures
Build the app (get the errors as expected)
Delete the line
Re-build the app
This stumped me for ages.
You need to add the following line inside your pod file inside your project.
config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
Add it for each build configuration. The full code to do this is:
post_install do |installer|
installer.pods_project.build_configurations.each do |config|
config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
end
end
There is also a chance that on an M1 machine you need to compile your pods using the x86_64 architecture. To do so running the following:
arch -x86_64 pod install
You can see the full solution on building for multiple architectures here.
Open your Build Settings and set Excluded Architectures value as arm64

Cocoapods project fails to build on an Apple Silicon / M1 Mac

Before you think that this is a duplicate:
There are several posts on this failing, but most of them are old posts not related to M1 Macs and some have contradictory solutions. This post is only for M1 Macs using Cocoapods with the following setup:
The setup
Cocoapods 1.10.1
Cocoapods configuration has generate_multiple_pod_projects and incremental_installation enabled
Terminal is set up to use Rosetta 2 to solve issues with Cocoapods
Several libraries used, such as Firebase, RxSwift etc and NearbyMessages
The problem
Compiling the project (that works on an intel computer) yields the following error for the NearbyMessages library from Google:
In /Users/user/Pods/NearbyMessages/Libraries/libGNSMessages.a(GNSAudioModem.o), building for iOS Simulator, but linking in object file built for iOS, file '/Users/user/Pods/NearbyMessages/Libraries/libGNSMessages.a' for architecture arm64
The most common suggestions are to add arm64 to "Excluded Architectures" and to set "Build Active Architectures Only" to YES (which is default). Other posts say that the latter should be NO. Setting this to No will instead give me the error No such module 'RxSwift'.
Adding arm64 to "Excluded Architectures" would also mean that I would need the following post install to all generated projects (since I am using generate_multiple_pod_projects) in the Pod file:
post_install do |installer|
installer.generated_projects.each do |project|
project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
end
end
end
end
What I want to understand is if this is the correct approach. Not just try different settings and hope for the best, but to understand why this would help. Why would I exclude arm64 when the M1 chip is arm64? Have I been using the wrong solutions? Any help would be appreciated.
The NearbyMessages binary pod distribution has not been updated with a slice to support the M1 Mac. Therefore it is not possible to link it into an app and build it for the simulator.
config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] =
"arm64e"
Initially with e in the end.

Cocoapods won't work on new m1 mac Big Sur Xcode

I am getting rid of my 8 year old mac, and am switching to the new m1 macbook air, but none of my old projects are running. I have installed cocoapods succesfully, but a lot of my big projects are running into errors, even after updating all the pods and running everything through Rosetta. Here are some of the errors I am running into in Xcode:
Could not find module 'PodName' for target
'x86_64-apple-ios-simulator'; found: arm64, arm64-apple-ios-simulator
No such module 'PodName'
These are just a few, encountering many errors. I tried updating these pods, reinstalling them, etc. but nothing is working. Has anyone with a m1 mac had any success with this?
You can tweak your project architecture or add the following at the very end of your Podfile (and run pod update again) :
post_install do |installer|
installer.pods_project.build_configurations.each do |config|
config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
end
end
This seems likely related to this question & answer here: Xcode 12, building for iOS Simulator, but linking in object file built for iOS, for architecture arm64
Basically what you'll need to do is make sure that:
The architectures being built is set to Standard Architectures (ARCHS_STANDARD)
That you add an 'excluded' architecture setting, for Any iOS Simulator and set it to arm64
That should get you up and running.
One thing to note (that caught me up for a while): Make sure that you do not have the Build Setting of "Valid Architectures" (VALID_ARCHS). If you do, delete the line entirely. It was causing issues for me, because it was effectively ignoring the new paradigm that Apple wants us to use (Architectures + Excluded Architectures).
Finally, if you do not see VALID_ARCHS but you're still unable to run it, one thing that worked for me (since I also was coming back to an old project) was to:
Add in VALID_ARCHS and set it to Standard architectures
Build the app (get the errors as expected)
Delete the line
Re-build the app
This stumped me for ages.
You need to add the following line inside your pod file inside your project.
config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
Add it for each build configuration. The full code to do this is:
post_install do |installer|
installer.pods_project.build_configurations.each do |config|
config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
end
end
There is also a chance that on an M1 machine you need to compile your pods using the x86_64 architecture. To do so running the following:
arch -x86_64 pod install
You can see the full solution on building for multiple architectures here.
Open your Build Settings and set Excluded Architectures value as arm64

Xcode doesn't find CocoaPods module

I'm using the CocoaAsyncSocket library for an application I am writing.
When I compile and run it on my own device there's no problem and Xcode is able to find CocoaAsyncSocket.
However when I'm trying to Archive it won't compile and I get the error message that the module CocoaAsyncSocket can't be found.
I've noticed that it has something to do with the different architectures. When I build for my own device its only building for "arm64" and when I'm archiving its building for arm64,armv7 and armv7s. If I change the build settings for archiving to only build for arm64 I'm able to archive. But of course I want to be able to build it for all architectures.
Picture below displays settings for when its only building for arm64 (in my case);
Build Active Architecture Only: Yes
Has anyone else experienced similar problems with this library or other Cocoapod libraries?
Make sure, the version in the Podfile is good
# Uncomment the next line to define a global platform for your project
platform :ios, '10.0'
Many developers have embraced the impending 64-bit future but not all third party libraries support this architecture yet, including those installable via CocoaPods.
Despite the lack of universal 64-bit support among 3rd-party pods, CocoaPods still includes the arm64 architecture (via ARCHS_STANDARD_INCLUDING_64_BIT) in its generated targets’ build settings. This can cause problems if your app’s dependencies don’t support arm64, or you only want to build for armv7 and armv7s for other reasons.
You can fix this just add the following to the bottom of your Podfile to revert the ARCHS build setting to ARCHS_STANDARD:
# Remove 64-bit build architecture from Pods targets
post_install do |installer|
installer.project.targets.each do |target|
target.build_configurations.each do |configuration|
target.build_settings(configuration.name)['ARCHS'] = '$(ARCHS_STANDARD_32_BIT)'
end
end
end
Note :
CocoaPods Troubleshooting Guide recommends matching the Debug setting in your Xcode project, rather than changing the Pod's Build Active Architecture Only. As long as they match it seems to fix the problem.
Select the Pods project
Change Build Active Architecture Only from Yes to No.
Or
You can try updating cocoapods in your terminal using command:
gem update cocoapods
If it doesn't work after that, go into your workspace, click on the Pod project, select all Pod targets and set Architectures to (armv7 armv7s arm64).

Pods was rejected as an implicit dependency for 'libPods.a' because its architectures 'XXX' didn't contain all required architectures

A friend updated Cocoapods in our project. When I pulled the latest stuff from git I got the following error:
Pods was rejected as an implicit dependency for 'libPods.a' because its architectures 'x86_64' didn't contain all required architectures 'i386'
This results in
ld: library not found for -lPods-___PODLIBRARY____
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I have searched around for hours now trying to find it. The most common fixes I've tried are..
Deleted derived data
Delete build data
Delete pods, and reinstalled with 'pod install'
Clean project
All of the above at the same time
Experimented with 'Build Active Architecture Only', both in our project and in Pod Project. Inserted armv7 and armv7s as hard code instead of $ variable
Experimented with 'Architectures', both in our project and in Pod Project. Inserted armv7 and armv7s as hard code instead of $ variable
We are aiming for iOS 8, iPhones.
My friend got it to work by combining the first 4 options, but I cannot.
Does anyone have any suggestions? We're supposed to release before christmas so production time is precious :D
Try to set Build Active Architecture Only to NO for 'Pods' project and your app's target
For me, what worked was to change the CocoaPod project "Base SDK" to "Latest iOS".
Try to run the project first on an iPhone 4s in simulator and after that it should work.
What fixed this problem for me was precisely the opposite of the most voted answer:
"Build Active Architecture Only" set to "YES"
both in main target and Pods target + Debug and Release
In my case, it was because I had the "Build Active Architecture Only" parameter set to Yes for Debug mode. Changing it no No fixed it.
Also make sure that your podfile targets the same iOS version your project targets:
For example, if you're targeting iOS 10.0 in your Xcode project your podfile should include platform :ios, '10.0' at the top, too.
Per this solution, which was the problem in my case.

Resources