Solving Cocoapods arm64 issues
You are just starting your new awesome iOS app. You have set up Podfile and all the libraries that you love. You will use Swift to code, because the functional is the way to go. Everything is set up and then you open up XCode to find out the error on build:
Undefined symbols for architecture arm64
Relax, the issue is with some of libraries that you like using (e.g. Crashlytics is build as 32bit pod). Ok, what now!?
In order to fix this there are 2 options:
- Figure out what library is the issue and recompile it or
- Update Build Settings and adjust Architectures to 32bit ones
The option #2 is much easier if you do not need to do something specific in your app that 32bit architecture would not support.
You can change this manually through XCode:
So just change the value for Architectures to "armv7 armv7s" or better use the variable "$(ARCHSSTANDARD32_BIT)". Leave the Valid Architectures as they are as you for sure want to support new devices as well.
Or even better, since you are already using Cocoapods why not let them handle this. Add the post_install hook to your Podfile like this:
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
And that's it.
NOTE: You may know this already but Cocopods still lacks Swift framework support, so you will have to combine cocoapods and checking git submodules. Though the support is coming along, join in, contribute, or be paitent..
UPDATE 10/21 Since Apple officialy announced not allowing apps that do not include 64-bit support, my post become deprecated quickly :) But this push is good as more and more pods are recompiled for 64-bit (e.g. Crashlytics mentioned above).