Mobile Dev

Flutter iOS Build Fails: Privacy Bundles Xcode Error

Fix Flutter iOS IPA build failure with 'Build input file cannot be found' for path_provider_foundation_privacy.bundle and image_picker_ios. Upgrade Flutter or add dummy executables workaround for Xcode 15.2 CopySwiftLibs issue.

1 answer 11 views

iOS Flutter Build Fails with “Build input file cannot be found” for Privacy Bundles

I’m encountering a build failure when creating an IPA for my Flutter iOS app, specifically with privacy bundles for the path_provider_foundation and image_picker_ios plugins.

Error Message

Error (Xcode): Build input file cannot be found: '/Users/builder/Library/Developer/Xcode/DerivedData/Runner-xxx/Build/Intermediates.noindex/ArchiveIntermediates/Runner/IntermediateBuildFilesPath/UninstalledProducts/iphoneos/path_provider_foundation_privacy.bundle/path_provider_foundation_privacy'. Did you forget to declare this file as an output of a script phase or custom build rule which produces it?

Environment Details

  • Flutter: 3.16.0
  • iOS deployment target: 13.0
  • Xcode: 15.2
  • CocoaPods: 1.16.2
  • Plugins: image_picker: ^1.2.0, path_provider: ^2.1.5

Troubleshooting Steps Attempted

  1. flutter clean and flutter pub get
  2. pod deintegrate and pod install
  3. Updated to latest plugin versions
  4. Cleaned DerivedData
  5. Verified that privacy bundles are generated in build/ios/Release-iphoneos/ with PrivacyInfo.xcprivacy files

Issue Description

The privacy bundles are being generated correctly with PrivacyInfo.xcprivacy files, but Xcode is looking for executable files with specific names (path_provider_foundation_privacy, image_picker_ios_privacy) inside these bundles.

Podfile Configuration

ruby
platform :ios, '13.0'

target 'Runner' do
 use_frameworks! :linkage => :static
 use_modular_headers!
 flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
end

post_install do |installer|
 installer.pods_project.targets.each do |target|
 flutter_additional_ios_build_settings(target)
 target.build_configurations.each do |config|
 config.build_settings['ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES'] = 'YES'
 config.build_settings['OTHER_LDFLAGS'] ||= []
 config.build_settings['OTHER_LDFLAGS'] << '-ObjC'
 end
 end
end

Question

Why is Xcode expecting executable files instead of the standard iOS privacy bundles? Is there a configuration issue in my project, or is this a known issue with these specific plugin versions?

The build works fine for debug builds but fails specifically during IPA creation (archive process). I need to successfully build the IPA file for distribution.

Your Flutter iOS build failed because Xcode 15.2 is incorrectly treating plugin privacy bundles (for example path_provider_foundation_privacy.bundle and image_picker_ios_privacy.bundle) as Swift executables during the IPA archive (CopySwiftLibs) step, so it looks for a non‑existent executable file and errors with “Build input file cannot be found”. The safest fix is to upgrade your Flutter toolchain (the fix appears in newer Flutter releases — see Flutter 3.19+ / latest stable), and if you can’t upgrade right away use a Run Script that creates small dummy executables inside every *_privacy.bundle or remove overly broad ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES overrides in your Podfile.


Contents


Why Xcode 15.2 treats privacy bundles as executables

Xcode’s archive process (the phase that runs for an IPA) includes steps that decide whether to embed Swift standard libraries. During that flow Xcode inspects bundles and—due to a change/bug in Xcode 15.2—appears to assume some bundles contain a Swift executable whose filename equals the bundle name. Flutter plugin privacy bundles (e.g. *_privacy.bundle) intentionally only ship a PrivacyInfo.xcprivacy resource; they do not include any binary. When Xcode looks for an executable like path_provider_foundation_privacy inside the bundle and can’t find it, you get:

Build input file cannot be found: '.../path_provider_foundation_privacy.bundle/path_provider_foundation_privacy'

That’s why the archive fails while debug builds often succeed — the CopySwiftLibs/embedding step behaves differently for archive/release builds. This behavior has been reported in the Flutter tracker and community threads; see the Flutter GitHub issue for the original reports and the community-suggested fixes (upgrade or create a dummy executable) https://github.com/flutter/flutter/issues/169272 and a detailed community answer on Stack Overflow https://stackoverflow.com/questions/79409806/upgrading-an-old-flutter-project-giving-privacy-errors.


How to confirm and reproduce the error locally

Quick checks to confirm Xcode is looking for an executable and that the privacy bundles only contain the .xcprivacy file:

  • Reproduce the archive and capture verbose logs:
  • From your project root:
flutter build ipa --release -v
  • Or use xcodebuild:
cd ios
xcodebuild -workspace Runner.xcworkspace -scheme Runner -configuration Release archive -archivePath /tmp/Runner.xcarchive
  • Inspect the built privacy bundles (paths will vary by DerivedData):
# Example — adjust the DerivedData path shown in your error:
ls -la "/Users/$(whoami)/Library/Developer/Xcode/DerivedData/Runner-*/Build/Intermediates.noindex/ArchiveIntermediates/Runner/IntermediateBuildFilesPath/UninstalledProducts/iphoneos" | grep privacy
find "/Users/$(whoami)/Library/Developer/Xcode/DerivedData/Runner-*/Build/Intermediates.noindex/ArchiveIntermediates/Runner/IntermediateBuildFilesPath/UninstalledProducts/iphoneos" -name "*_privacy.bundle" -exec sh -c 'echo "--- {}"; ls -la "{}"' \;

You should see PrivacyInfo.xcprivacy inside each privacy bundle and no executable with the bundle base name.

  • Check the failing Xcode phase name in the log — the error usually appears during a CopySwiftLibs / Embed Swift step.

If logs show CopySwiftLibs trying to use an executable inside the privacy bundle, you’ve reproduced the exact issue.


Recommended fix — Upgrade Flutter (best option)

Why upgrade? Plugin packaging and Flutter tooling were updated upstream to avoid the archive-time failure by either adjusting how privacy bundles are handled or by providing the required placeholders. The community and maintainers recommend upgrading your Flutter SDK to a version that includes that fix (Stack Overflow reports Flutter 3.19+ as the version range where fixes appear). See the Stack Overflow thread and the Flutter issue for context: https://stackoverflow.com/questions/79409806/upgrading-an-old-flutter-project-giving-privacy-errors, https://github.com/flutter/flutter/issues/169272.

Upgrade steps (safe path):

  1. Update Flutter:
flutter upgrade
flutter --version # confirm new stable version
flutter pub get
  1. Reinstall iOS dependencies:
cd ios
pod deintegrate
pod install --repo-update
cd ..
  1. Clean and build an IPA:
flutter clean
flutter build ipa --release

After upgrading, try archiving again. If the problem disappears you’re done — the newer toolchain or plugin packaging handled the privacy bundles properly.


Workaround — add dummy executables for privacy bundles (temporary)

If you can’t upgrade Flutter immediately (CI constraints, project freeze, etc.), the common temporary workaround is to create a tiny dummy executable file inside every *_privacy.bundle before Xcode attempts to embed Swift libs. Many in the community used a Run Script build phase that runs during archive and creates these files.

  1. Add a Run Script phase to your Runner target in Xcode:
  • In Xcode: select the Runner target → Build Phases → + → New Run Script Phase.
  • Place this Run Script near the top of the list (ensure it runs before the failing embed/copy step).
  • Optionally limit it to Release/archive only by checking “Run script only when installing” or by using the CONFIGURATION/ACTION guard in the script.
  1. Use this robust script (handles spaces and only runs for archive/release):
bash
#!/bin/sh
# Only run for archive or Release builds
if [ "${ACTION}" != "archive" ] && [ "${CONFIGURATION}" != "Release" ]; then
 exit 0
fi

echo "Ensuring privacy bundle dummy executables exist..."

find "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" -name "*_privacy.bundle" -print0 |
 while IFS= read -r -d '' bundle; do
 base=$(basename "$bundle")
 exec_path="$bundle/$base"
 if [ ! -f "$exec_path" ]; then
 touch "$exec_path"
 chmod +x "$exec_path"
 echo "Created $exec_path"
 fi
 done
  1. Re-run archive. The created files satisfy Xcode’s expectation so CopySwiftLibs won’t fail.

Notes:

  • This is a workaround; remove it once you upgrade Flutter or the underlying tooling is fixed.
  • If building on CI (e.g., GitHub Actions, Codemagic), ensure the build uses the modified Xcode project or include an equivalent step in your CI script that touches the files in DerivedData before archive.

Reference community scripts and discussion: https://stackoverflow.com/questions/79409806/upgrading-an-old-flutter-project-giving-privacy-errors.


Podfile & build-settings to check (common culprit)

Your Podfile snippet includes:

ruby
config.build_settings['ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES'] = 'YES'

Setting ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES unconditionally for every pod target can cause Xcode to run the Swift embedding logic for pods that are resource-only (like privacy bundles). That may trigger the behavior where Xcode looks for executables inside those bundles.

Options:

  • Remove the unconditional override and let CocoaPods/Xcode decide by default.
  • Or set it only for targets that actually declare SWIFT_VERSION. Example conditional (in your post_install):
ruby
installer.pods_project.targets.each do |target|
 flutter_additional_ios_build_settings(target)
 # Only set embed for pods that contain Swift
 if target.build_configurations.any? { |c| c.build_settings['SWIFT_VERSION'] }
 target.build_configurations.each do |config|
 config.build_settings['ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES'] = 'YES'
 end
 end
end

After adjusting Podfile, run:

cd ios
pod deintegrate
pod install

Then clean and attempt an archive again. If the unconditional ALWAYS_EMBED… setting was causing CopySwiftLibs to treat resource bundles as Swift targets, this change will prevent that.


Other troubleshooting steps (DerivedData, pods, CI)

  • Completely clear DerivedData (targeted or full):
rm -rf ~/Library/Developer/Xcode/DerivedData/*
  • Run flutter clean then flutter pub get.
  • Re-integrate CocoaPods:
cd ios
pod deintegrate
pod install --repo-update
cd ..
  • Build with verbose logging to capture the failing phase:
flutter build ipa -v
  • Verify plugin versions actually include privacy manifests and any fixes. The image_picker changelog discusses privacy manifest changes: https://pub.dev/packages/image_picker/changelog
  • If CI builds fail, replicate locally; ensure CI uses the same Xcode and CocoaPods versions as your machine.

A more generic “Build input file cannot be found” can also be caused by stale pbxproj references; see general troubleshooting notes here: https://sarunw.com/posts/how-to-fix-build-input-file-cannot-be-found/. For this specific privacy‑bundle case, the missing executable is the symptom described above rather than a simple stale file reference.


When to file a bug / what to include

If you upgrade Flutter and plugins and still see the archive failure, open a minimal reproducible issue on the Flutter GitHub (or add a note to the existing issue). Include:

  • flutter doctor -v
  • Exact Flutter version and commit (if on a non-stable channel)
  • Xcode version (15.2 in your case)
  • CocoaPods version
  • Podfile contents
  • The exact archive command or CI build logs (use -v to get verbose logs)
  • A small sample project or steps to reproduce
  • The failing log lines showing the “Build input file cannot be found” path

Start with the existing tracker to avoid duplicates: https://github.com/flutter/flutter/issues/169272.


Sources


Conclusion

The root cause is Xcode (15.2) treating Flutter plugin privacy bundles as if they contained Swift executables, so it searches for a missing binary during archive and the Flutter iOS build fails. The recommended, permanent fix is to upgrade Flutter to a release that fixes privacy-bundle handling; the practical temporary fixes are (1) add a Run Script that creates small dummy executables inside each *_privacy.bundle before the CopySwiftLibs step or (2) remove/restrict unconditional ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES settings in your Podfile. After upgrading or applying a safe workaround you should be able to build the IPA successfully.

Authors
Verified by moderation
Moderation
Flutter iOS Build Fails: Privacy Bundles Xcode Error