Access Parent Project Other_Swift_Flags from Pod

access parent project OTHER_SWIFT_FLAGS from pod

So basically it looks like this.
Accessing the xcode project, then accessing the pod and looping through each config to set the proper value.

post_install do |installer|
require 'xcodeproj'
project_path = 'pathTo/myProj.xcodeproj' # path to your xcode project
project = Xcodeproj::Project.open(project_path)
project.targets.each do |target|
if target.name == 'myTarget' # name of the target in your main project containing the custom flag
installer.pods_project.targets.each do |podTarget|
if podTarget.name == 'myPod' #name of your pod
target.build_configurations.each do |targetConfig|
podTarget.build_configurations.each do |podConfig|
podConfig.build_settings["OTHER_SWIFT_FLAGS"] = targetConfig.build_settings["OTHER_SWIFT_FLAGS"]
end
end

end
end
end
end

Access parent project SWIFT_FLAGS/SWIFT_ACTIVE_COMPILATION_CONDITIONS from pod framework

Here is a post_install hook that I came up using help from other similar posts.

Fill SWIFT_ACTIVE_COMPILATION_CONDITIONS in the project
and add code below to the Podfile.

Xcode 10.

post_install do |installer|

require 'xcodeproj'
project_path = 'Test.xcodeproj' # path to your xcode project
project = Xcodeproj::Project.open(project_path)

project.targets.each do |projectTarget|
if projectTarget.name == 'Test' # name of the target in your main project containing the custom flags
installer.pods_project.build_configurations.each do |podConfig|
projectTarget.build_configurations.each do |projectConfig|
if projectConfig.name == podConfig.name
podConfig.build_settings["SWIFT_ACTIVE_COMPILATION_CONDITIONS"] ||= [projectConfig.build_settings["SWIFT_ACTIVE_COMPILATION_CONDITIONS"]]
end
end
end
end
end

end

CocoaPods error with Card.io

Try adding $(inherited) to your 'Other linker flags' build setting.

CocoaPods UIImageView+AFNetworking.h unrecognized selector setImageWithURLRequest

I had the same problem with Xcode 5, Cocoapods and AFNetworking 1.3.3.

I found my answer in this Google Groups discussion: AFNetworking unrecognized selector

Make sure your project and target settings aren't overwriting the values in the xcconfig file.

Each level should have (at least) $(inherited) to inherit the settings of the parent.

In Build Settings, make sure you have $(inherited) in Other Linker Flags.

Build Settings before I added $(inherited) (choose Levels, not Combined):

Other Linker Flags without $(inherited)

Build Settings after I added $(inherited):

Other Linker Flags with $(inherited)

That fixed it for me.



Related Topics



Leave a reply



Submit