How to set 'exclude_files' in Podfile rather than podspec - ios

I've created a new react-native project (0.61.5) and am trying to install react-native-track-player. The default installation docs are pretty sparse but after going through the issues I was able to successfully get the app running, just in a hacky way.
The solution I needed is found in this thread. Setting s.exclude_files = ["ios/RNTrackPlayer/Vendor/AudioPlayer/Example"] in node_modules/react-native-track-player/react-native-track-player.podspec works but I don't want to add it again every time my node_modules folder gets reset.
I saw in a different thread (and ended up using this as well) that setting the swift version in the Podfile to 5 in the post_install method will set the proper version of swift for react-native-track-player to work. I thought maybe I could move the exclude_files hack from node_modules podspec file to my Podfile and solve all my problems, only it seems to not work when set there:
post_install do |installer|
installer.pods_project.targets.each do |target|
if ['react-native-track-player'].include? target.name
target.build_configurations.each do |config|
config.build_settings['SWIFT_VERSION'] = '5'
config.build_settings['EXCLUDE_FILES'] = '../node_modules/react-native-track-player/ios/RNTrackPlayer/Vendor/AudioPlayer/Example`
end
end
end
end
TLDR:
Is it possible to set exclude_files in my Podfile in the post_install call?

Related

Flutter 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 15.4.99

In the last 3 years. Ive probably spent 2 weeks on this issue, it comes up often if you are cloning and working on other peoples projects but doesn't usually occur on your own.
There are a tonne of answers on the stackoverflow and sometimes you use one answer and it works and other times you have to use another answer. I have solved this issue countless times and never has the same solution worked every time.
this is the error:
'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 15.4.99.
Where is this error actually coming from, what setting in flutter needs to be changed. I will list all the ways below that have been able to fix it after the error but what I want to know is where is the setting that is causing this problem in the first place.
These are the setting and ways I have used to fix this:
Updating pod file platform:
# Uncomment this line to define a global platform for your project
platform :ios, '13.0'
Updating AppFrameworkInfo.plist:
<key>MinimumOSVersion</key>
<string>13.0</string>
Updating runner deployment target in Xcode:
Updating pods deployment target in Xcode:
Changing the script in the podfile (this works but then causes other errors):
post_install do |installer|
installer.pods_project.targets.each do |target|
flutter_additional_ios_build_settings(target)
end
end
to this
post_install do |installer|
installer.pods_project.targets.each do |target|
flutter_additional_ios_build_settings(target)
target.build_configurations.each do |config|
if config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'].to_f < 13.0
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '13.0'
end
end
end
end
Updating the project format in Xcode:
Also:
Deleting pod file
Deleting podfile.lock
Deleting the pods directory
Deleting the .symlinks directory
Flutter clean
Deintegrating pods
Pod cache clean -all
Pod repo update
Pod update
Pod install
I wonder if this error even represents the real issue or whether is is something else entirely because if you look at the generated podspec file it lists the ios.deployment target as 9 not 8?. Where is the error coming from and where in Flutter can this be changed?
Thanks

How to prevent 'pod install' from overriding XCode 'BUILD_LIBRARY_FOR_DISTRIBUTION' setting?

'pod install' overrides the following pod setting of XCode IDE if set:
BUILD_LIBRARY_FOR_DISTRIBUTION=NO
Or to be more precise - it just deletes it meaning it will default to "YES" (for each library).
This kills our build since we have libs (like OpenCombine, BetterSegment) that afterwards fail to build because build warnings are then handled as errors.
The only workaround is to make this setting again in XCode afterwards for each problematic library.
A workaround (until there exists a flag or bugfix for cocoapods) is to add the following in your Podfile:
post_install do |installer|
installer.pods_project.build_configurations.each do |config|
config.build_settings["BUILD_LIBRARY_FOR_DISTRIBUTION"] = "NO"
config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
end
installer.pods_project.targets.each do |t|
t.build_configurations.each do |config|
config.build_settings["BUILD_LIBRARY_FOR_DISTRIBUTION"] = "NO"
end
end
end
This adds a post build hook to enable this setting again on library & global pod project level.
Which is btw a common solution to set XCode pod configs back if 'pod install' is messing around with them.

How to update swift 2.3 project to latest swift 4

I am having too many cocoapods installed. It shows too many compile time errors. How to solve this?
I am new to swift so looking for help.
Thanks
Choose auto upgrade after opening the project in Xcode 9.
In Podfile refer to the framework built in swift 4. Add below script in your Podfile and do a pod install, which will set the swift version of all pod targets to 4.
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['SWIFT_VERSION'] = '4'
end
end
end
Hope this helps in proceeding in upgrading the application to swift4

Pod is built for newer version of

After changing both the deployment target of my project and targets from IOS 10.3 to 9.0 I am receiving the following errors. What am I doing wrong?
edit: These errors only show up when running my code in release not debug
Paste this at the end of your podfile
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '9.0'
end
end
end
First try cleaning the project (shift+command+K). This likely won’t help but is always worth a try.
If/when cleaning does not work, check that the desired iOS version is in podfile, and then navigate to the project directory in Terminal and run pod update.

Error compiling RealmSwift with Xcode 8.2.1 and Swift 3

I installed RealmSwift using Cocoapods. It installed successfully, but when compiling it shows 96 errors as shown below
I have tried every solution I found on the internet. I have deintegrated the pods and installed again, but I keep getting the same errors. Please help!
It looks like Xcode is trying to run Realm Swift against the wrong version of Swift. A couple of things that I recommend you try:
Make sure to run pod spec update to update your local copy of Realm to the latest version.
Make sure you've followed the Realm CocoaPods instructions and added this to the bottom of your podfile:
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['SWIFT_VERSION'] = '3.0.2'
end
end
end
If that still doesn't fix it for you, please update your question with a copy of your podfile so we can review it. :)

Resources