3

Is there a way to include the architecture in a CocoaPods Podfile? I am trying to build my app for both 32 and 64 bit but when I switch to Standard architectures (including 64-bit) in my project's build settings, it complains that I should let it automatically choose architectures. Doing this reverts my project back to Standard architectures. I have a feeling that Xcode is doing this because the Pods project (in my Xcworkspace) does not include 64-bit in its architectures. Is there a way to add this to the Podfile(I assume better if Pod does it itself) or should I change it in the Pods project as well.

My current Podfile:

xcodeproj 'Nobles/Nobles.xcodeproj'

platform :ios, '7.0'

pod 'Reachability'
pod 'TWTSideMenuViewController'
carloabelli
  • 4,289
  • 3
  • 43
  • 70

2 Answers2

4

I'm searching for answers to a similar issue and found this:

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:

# 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

Maybe this can help you?

Dr. Andrew Burnett-Thompson
  • 20,980
  • 8
  • 88
  • 178
0

CocoaPods can't do what you want. It can give you different versions of the library, but it doesn't know anything about how that library was built.

Run xcrun -sdk iphoneos lipo -info libYourLibraryName.a to see which architectures it was built for.

If this is an open-source library, you can build it yourself, instead of just linking the .a file. If you don't have access to the library source, and the .a file doesn't include the 64 bit slice, I'm afraid you're out of luck. Contact the developer and ask them to build the library with the 64 bit support.

TotoroTotoro
  • 17,524
  • 4
  • 45
  • 76
  • Would setting the Pods project to include 64 bit manually work? – carloabelli Dec 17 '13 at 01:13
  • How do you do that? In iOS static libraries/frameworks are normally distributed as a single .a file that includes slices for all the supported architectures. If the library was not built for 64 bit, I don't know what CocoaPods can possibly do about that. – TotoroTotoro Dec 17 '13 at 01:13
  • In my workspace I have two projects (my main project and one called Pods). In the Pods project there is the same set Architecture setting. I don't know if it will work, but I guess it's worth a try. – carloabelli Dec 17 '13 at 01:17
  • Like I said, if you have the full source code for your library under the Pods project, you can build it for 64 bit architecture yourself. – TotoroTotoro Dec 17 '13 at 01:19
  • How would I go about doing this? – carloabelli Dec 17 '13 at 01:20
  • You go about this by changing the build settings for the Pods static library in the Pods project. However, unless you are using some code optimized for x64 architectures, its really not worth the hassle. – gdavis Dec 17 '13 at 03:51