This page answers common questions encountered when using rules_xcodeproj. If your question isn’t answered here, check the GitHub Issues — someone may have run into the same problem, or you can file a new one.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/MobileNativeFoundation/rules_xcodeproj/llms.txt
Use this file to discover all available pages before exploring further.
Why do I get a visibility or unexported files error with xcodeproj?
Why do I get a visibility or unexported files error with xcodeproj?
xcodeproj target declared in the same package as your top_level_targets, internally rules_xcodeproj creates another target in a sub-package under the @rules_xcodeproj_generated repo. You’ll need to adjust your visibility/package_group to include "@rules_xcodeproj//xcodeproj:generated", and export any files used in xcodeproj.{associated_,}extra_files.Does the Archive action work?
Does the Archive action work?
.xcarchive that the Archive action produces.Instead of using the Archive action to submit to the App Store, you should generate an IPA with bazel and upload that.Why are there multiple versions of some of my targets?
Why are there multiple versions of some of my targets?
xcodeproj.top_level_targets has targets with multiple configurations, they will be included in the project with those various configurations. This can be useful/expected — for example, having multiple platform versions of a given swift_library. When possible, the generated project will consolidate these various versions of a target into a single Xcode target. When targets can’t be consolidated (usually because they are functionally equivalent from Xcode’s point of view), they will appear as separate Xcode targets.If you have multiple unexpected versions of some targets — usually with a hash after their name — that is unintended. Check whether your build is adding multiple configurations of the same targets to the build graph (e.g. app extensions or tests having different minimum OS versions than the app, which can possibly be fixed by using minimum deployment OS version instead). If you need help, reach out to us.One particular case to watch out for is accidentally including a watchos_application in xcodeproj.top_level_targets when it’s being embedded in an ios_application target. watchos_application targets should only be included in xcodeproj.top_level_targets when they are not being embedded by an ios_application target, since they will have a different configuration applied to them, resulting in multiple Xcode targets.What is CompileStub.m?
What is CompileStub.m?
ios_application, and its primary library dependency is also directly depended on by another top-level target, such as ios_unit_test, then the library cannot be merged into the first top-level target. When that happens, the first top-level target has no source files, so a stub file (CompileStub.m) must be added to allow Xcode to link to the proper library target.If this setup isn’t desired (e.g. you want the target merged to enable Xcode Previews), there are a couple of ways to fix it:- For tests, setting the first top-level target as the
test_hostwill allow the library to merge. - In other cases, refactor the build graph to have the shared code in its own library, separate from the top-level target’s primary library.
Why do some of my swift_librarys compile twice in BwX mode?
Why do some of my swift_librarys compile twice in BwX mode?
- Refactor mixed-language targets to single-language targets, removing the need for the custom modulemap that references the Swift generated header.
- Remove the use of header maps (hmaps), or don’t include Swift generated headers in them.
- Use BwB mode instead.
Why does Xcode complain about stale files?
Why does Xcode complain about stale files?
Why does "X" happen when switching between build modes?
Why does "X" happen when switching between build modes?
xcodeproj target for each build mode if needed.Why do I not see any simulators after generating the project?
Why do I not see any simulators after generating the project?
Why do I get an error like "Provisioning profile is Xcode managed, but signing settings require a manually managed profile"?
Why do I get an error like "Provisioning profile is Xcode managed, but signing settings require a manually managed profile"?
provisioning_profile you have set on your top-level target (e.g. ios_application) is resolving to an Xcode managed profile. This is common if you use the local_provisioning_profile rule. If that is desired, use the xcode_provisioning_profile rule to tell xcodeproj that this is an Xcode managed profile::provisioning_profile target must be a rule that returns the AppleProvisioningProfileInfo provider (such as local_provisioning_profile), and the team_id attribute on that provider must be set — or team_id must be set on the :xcode_profile target.Why do I get: Xcode could not find provisioning profiles matching TEAM_ID/PROFILE_NAME?
Why do I get: Xcode could not find provisioning profiles matching TEAM_ID/PROFILE_NAME?
provisioning_profile you have set on your top-level target (e.g. ios_application) is resolving to a provisioning profile that hasn’t yet been installed to ~/Library/MobileDevice/Provisioning Profiles. This is common if you use the local_provisioning_profile rule and specify fallback profiles, or if you specify a profile in the workspace.Copying the profile to ~/Library/MobileDevice/Provisioning Profiles will resolve the error.