iOS

Resolving CocoaPods Build Error Due to Targets Building for Only Active Architecture

I always have a build error after pod install, because by default, CocoaPods will configure your pods to build for active architecture only (during debugging).

The solution is to change Pods project setting Build Active Architecture Only to NO for debug.

But it is tedious to change every time after you run pod install (as your change will get reverted back to YES).

As suggested by msmollin in CocoaPods issues, you can fix by with:

1
2
3
4
5
6
7
8
# Append to your Podfile
post_install do |installer_representation|
    installer_representation.pods_project.targets.each do |target|
        target.build_configurations.each do |config|
            config.build_settings['ONLY_ACTIVE_ARCH'] = 'NO'
        end
    end
end

Comments