Re: "A build only device cannot be used to run this target" appearing with "Any Mac" scheme
Re: "A build only device cannot be used to run this target" appearing with "Any Mac" scheme
- Subject: Re: "A build only device cannot be used to run this target" appearing with "Any Mac" scheme
- From: Matt Jacobson via Cocoa-dev <email@hidden>
- Date: Mon, 23 Aug 2021 13:59:09 -0400
Hey Gabriel,
> On Aug 23, 2021, at 1:48 PM, Gabriel Zachmann via Cocoa-dev
> <email@hidden> wrote:
>
> I have a screensaver that compiles and runs fine when I use the active scheme
> "My Mac".
> However, when I switch to "Any Mac (Apple Silicon, Intel)", I get the error
> message
> "A build only device cannot be used to run this target"
> in Xcode immediately.
>
> Maybe, the following info is related to this error message, maybe not:
> The scheme is a bit uncommon, perhaps, because it has a Pre-action in the Run
> tab
> (which copies the .saver bundle into ~/Library/Screen Savers),
> and in the Run section the Executable is set to "System Preferences.app".
> (It works fine under the "My Mac" scheme.)
That pop-up actually has two halves: first, a scheme, and second, a run
destination.
“Any Mac” and “My Mac” are run destinations, not schemes. But, as you’ve seen,
“Any Mac” is a special “build-only” run destination that only supports
building, not running.
You should be able to pair your scheme with either of those run destinations.
(If not, check the ARCHS (“Architectures”) setting of your targets. Normally,
it should be set to $(ARCHS_STANDARD) (“Standard Architectures (Apple Silicon,
Intel)”) — which is the SDK default anyway.)
If you wish to build your scheme with the “My Mac” run destination and make
sure you’re building for both architectures, check out the ONLY_ACTIVE_ARCH
(“Build Active Architecture Only”) build setting. When YES, Xcode will build
only for the architecture of your run destination; when NO, it’ll build for all
valid architectures.
Normally, ONLY_ACTIVE_ARCH is set to YES for debug builds and NO for release
builds. The idea is to avoid slowing down your edit-build-debug cycle by
building code you’re not going to run. However, some people like to change
that.
HTH,
Matt
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden