I have an iOS app.
When I install pods via CLI to my project for the first time, launch Xcode, and then run the app, everything works fine – no build errors.
But after several instances of running the project on my device, all of a sudden build errors appear like:
/Pods/FirebaseCrashlytics/Crashlytics/Crashlytics/Settings/Models/FIRCLSApplicationIdentifierModel.m:19:9 'Crashlytics/Shared/FIRCLSByteUtility.h' file not found
/Pods/PostHog/vendor/libwebp/ph_sharpyuv_csp.h /Pods/PostHog/vendor/libwebp/ph_sharpyuv_csp.h: No such file or directory
And I have no idea why if it's because of my PodFile or any Build Settings/Phases/Rules, but this keeps happening repeatedly and it's impossible to develop anything with this.
I've tried a string of commands such as "pod deintegrate", "pod cache clean --all", removing PodFile.lock and doing pod install again, removing derived data, and cleaning build folder. I still keep running into the same build error and it's always after a few builds this happens, nothing is missing prior when the project successfully builds.
Here is my PodFile for reference:
# Uncomment the next line to define a global platform for your project
platform :ios, '17.0'
def google_utilities
pod 'GoogleUtilities/AppDelegateSwizzler'
pod 'GoogleUtilities/Environment'
pod 'GoogleUtilities/ISASwizzler'
pod 'GoogleUtilities/Logger'
pod 'GoogleUtilities/MethodSwizzler'
pod 'GoogleUtilities/NSData+zlib'
pod 'GoogleUtilities/Network'
pod 'GoogleUtilities/Reachability'
pod 'GoogleUtilities/UserDefaults'
end
target 'SE' do
# Comment the next line if you don't want to use dynamic frameworks
use_frameworks!
# Pods for SE
pod 'Firebase/Core'
pod 'Firebase/Firestore'
pod 'Firebase/Auth'
google_utilities
end
target 'NSE' do
# Comment the next line if you don't want to use dynamic frameworks
use_frameworks!
# Pods for NSE
pod 'Firebase/Messaging'
google_utilities
end
target 'targetApp' do
# Comment the next line if you don't want to use dynamic frameworks
use_frameworks!
#Pods for targetApp
pod 'Firebase/Core'
pod 'Firebase/Crashlytics'
pod 'Firebase/Messaging'
pod 'Firebase/Firestore'
pod 'Firebase/Storage'
pod 'Firebase/Functions'
pod 'PromiseKit', '~> 6.0'
pod 'lottie-ios'
pod 'GooglePlaces'
pod 'JWTDecode', '~> 2.4'
pod 'PostHog'
pod 'Kingfisher', '~> 8.0'
pod 'PhoneNumberKit'
google_utilities
end
post_install do |installer|
installer.aggregate_targets.each do |target|
target.xcconfigs.each do |variant, xcconfig|
xcconfig_path = target.client_root + target.xcconfig_relative_path(variant)
IO.write(xcconfig_path, IO.read(xcconfig_path).gsub("DT_TOOLCHAIN_DIR", "TOOLCHAIN_DIR"))
end
end
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
if config.base_configuration_reference.is_a? Xcodeproj::Project::Object::PBXFileReference
xcconfig_path = config.base_configuration_reference.real_path
IO.write(xcconfig_path, IO.read(xcconfig_path).gsub("DT_TOOLCHAIN_DIR", "TOOLCHAIN_DIR"))
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '17.0'
end
end
end
installer.pods_project.targets.each do |target|
if target.name == 'BoringSSL-GRPC'
target.source_build_phase.files.each do |file|
if file.settings && file.settings['COMPILER_FLAGS']
flags = file.settings['COMPILER_FLAGS'].split
flags.reject! { |flag| flag == '-GCC_WARN_INHIBIT_ALL_WARNINGS' }
file.settings['COMPILER_FLAGS'] = flags.join(' ')
end
end
end
end
end
And here is my only "Run Script" in Build Phases:
"${PODS_ROOT}/FirebaseCrashlytics/upload-symbols" \
-gsp "${PROJECT_DIR}/targetApp/GoogleService-Info.plist" \
-p ios \
"${DWARF_DSYM_FOLDER_PATH}/${DWARF_DSYM_FILE_NAME}"