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):
Build Settings after I added $(inherited)
:
That fixed it for me.
Related Topics
Macos Security Scoped Url Bookmark for Folder
Get Path of a File in a Data Set Located in Assets.Xcassets
Include Dictionary or Array Value in Swift String with Backslash Notation
Why This Line Is Not Covered? Xcode Code Coverage
Nscalendar in Swift - Init Can Return Nil, But Isn't Optional
Table View Cells Changing Colors When Scrolling Swift
How to Detect If The User Was Deleted from Firebase Auth
Convert/Wrap Swift Struct as Nsvalue for Caanimation Purposes
Detect When a Custom Cell Is Selected from Within The Cell Itself
Apple Turicreate Always Return The Same Label
Facebook Graphrequest for Swift 5 and Facebook Sdk 5
Make Tabview Background Transparent
Converting Cmtime to String Is Wrong Value Return
How to Change Font Size of Nstableheadercell
Swift Can Change Struct Declared with Let If Using an Index But Not If Using a Loop