Declare Architecture in Podfile

橙三吉。 提交于 2021-01-28 04:01:12

问题


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'

回答1:


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?




回答2:


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.



来源:https://stackoverflow.com/questions/20622481/declare-architecture-in-podfile

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!