Nice programing

빌드 전용 장치는이 대상을 실행하는 데 사용할 수 없습니다.

nicepro 2020. 10. 26. 21:05
반응형

빌드 전용 장치는이 대상을 실행하는 데 사용할 수 없습니다.


앱을 테스트하려고 할 때이 오류가 발생합니다.

이 대상을 실행하는 데 빌드 전용 장치를 사용할 수 없습니다.

지원되는 iOS 기기가 없습니다. 장치를 연결하여 애플리케이션을 실행하거나 시뮬레이션 된 장치를 대상으로 선택하십시오.


추가 -destination 'platform=iOS Simulator,name=iPhone 6,OS=9.3'xcodebuild


구성표가 일반 장치로 전환되었을 수 있습니다. 구성표 메뉴에서 연결된 장치를 다시 선택하십시오.

메뉴 이미지


아래는 내 방식입니다

프로젝트 선택-> 일반-> 배포 정보-> 배포 대상-> 낮은 버전 선택 여기에 이미지 설명 입력


"일반 iOS 기기"만 선택할 수있는 문제가 있습니다. 그리고 내가 실행할 때 "빌드 전용 장치를이 대상을 실행하는 데 사용할 수 없습니다. 지원되는 iOS 장치를 사용할 수 없습니다. 장치를 연결하여 응용 프로그램을 실행하거나 시뮬레이션 된 장치를 대상으로 선택하십시오"라고 표시됩니다.

문제에 대한 내 솔루션은 빌드 설정 ---> 배포 -----> IOS 배포 대상 ----> 8.0과 같은 낮은 버전을 선택하는 것입니다.

시뮬레이터가 나오고 선택할 수 있습니다.


유효한 목적지 목록을 가져와야합니다. 이를 위해 잘못된 키-값 쌍을 지정하면 xcodebuild가 작동하는 조합을 뱉어냅니다.

대상 나열 명령

xcodebuild test -destination 'platform=iOS Simulator' -workspace Register.xcworkspace -scheme ThatTestTarget

출력 예

Available destinations for the "ThatTestTarget" scheme:
    { platform:iOS Simulator, id:145A9B7E-B336-4819-8059-2FFEC408E05E, OS:11.1, name:iPad (5th generation) }
    { platform:iOS Simulator, id:69ABAF6F-ADA3-4E38-AC97-D71001447663, OS:9.3, name:iPad 2 }
    { platform:iOS Simulator, id:550E2F18-406D-4586-84BB-E48F1D704F27, OS:10.3.1, name:iPad Air }
    { platform:iOS Simulator, id:94734F1C-775F-40FA-9015-8196C08805EF, OS:11.1, name:iPad Air }
    { platform:iOS Simulator, id:1DB953DD-CD97-4EC7-8006-BCF01DF3E63F, OS:11.1, name:iPad Air 2 }
    { platform:iOS Simulator, id:DE3072DA-2E31-423D-9D77-220626F8B90A, OS:11.1, name:iPad Pro (9.7-inch) }
    { platform:iOS Simulator, id:3B5D18DB-13B5-4F28-B654-7D2ECDD1F6F0, OS:11.1, name:iPad Pro (10.5-inch) }
    { platform:iOS Simulator, id:A4225E3A-512C-4F42-ADD9-1E7E448C4D27, OS:11.1, name:iPad Pro (12.9-inch) }
    { platform:iOS Simulator, id:684FF1BA-8784-4B7C-B4E5-5231772F0FAC, OS:11.1, name:iPad Pro (12.9-inch) (2nd generation) }

등호에 대한 콜론 변경, 공백 제거, ID 무시

따라서이 대상을 사용하려는 경우 :

platform:iOS Simulator, id:684FF1BA-8784-4B7C-B4E5-5231772F0FAC, OS:11.1, name:iPad Pro (12.9-inch) (2nd generation)

쉼표의 콜론을 변경하고 공백을 제거하고 ID를 제거하면 다음 문자열이 표시됩니다.

platform=iOS Simulator,OS=11.1,name=iPad Pro (12.9-inch) (2nd generation)

그러면 전체 명령은 다음과 같습니다.

xcodebuild test -destination 'platform=iOS Simulator,OS=11.1,name=iPad Pro (12.9-inch) (2nd generation)' -workspace Register.xcworkspace -scheme ThatTestTarget

앱을 컴파일하는 Xcode의 "Build Only Device"를 위해 빌드하고 있습니다. ARM 프로세서 용 (시뮬레이터 용 컴파일은 Mac의 Intel CPU를 대상으로합니다.)

Plug in a device and select it from the active scheme popup, or, select one of the simulators and you should be good to go.


With XCode 8.3.2 I had this error message after I tried to run the app on a locked device. I unlocked and reattached as requested but the "A build only device cannot be used to run this target." message appeared.

I simply changed the target to a simulator and changed it back - it resolved my issue.


Modification to @Quver's answer. With latest Xcode version(8.3), the parameters to destination command should be given in double quotes. Single quotes didn't work for me

add -destination "platform=iOS Simulator,name=iPhone 7" to your xcodebuild

I haven't mentioned OS version in above command because when a newer version of iOS is released, this command will through error telling that this device is not found. So it is better not to give OS version


  1. I applied for a new AppleID and added it to the "Xcode->Preferences->Account" to solve this problem. (Xcode 7.3)
  2. At the same time I deleted original AppleID in the "Xcode->Preferences->Account",because it was no longer a paid account and couldn't add new devices.

xcodebuild things were not working in my case.

Here's what I've solved.

I've removed my apple account and re-set(login) on the xcode preference, and this was solved.

ps. on iphone 10.1, I needed to push Trust button on General > Device Management > account info > Trust App


For what it's worth, if you get the error A build only device cannot be used to run this target, and see in the Issue navigator this text:

ProjectName
Target Integrity:
iOS Deployment Target 'XX.X' is
newer than SDK 'iOS YY.Y' in
target ProjectName

then the issue is that the project requires an iOS SDK that is newer than what your version of Xcode has available. You'll find this issue in, say, projects taking advantage of new/beta iOS SDK functionalities such as ARKit.

The solution is to download the newest beta version of Xcode, which should have support for the non-public released iOS SDK that the application requires. If you have the latest Xcode, try finding the target iOS in Preferences -> Components -> Simulators.


I fixed this issue for emulator,

Firstly check your emulator list

Window > Devices and Simulators

after choose any device and click check OS Version

If you have only Apple Watch OS, You should download new IOS Simulator

and click download more simulator runtimes..

choose your correct IOS Simulator and download it.


I fixed this issue by going to the project settings, and under my 'Targets' section I had to set the Tests target to the correct team.


Well if you want to get the list of available destinations then call xcodebuild and pass in the command line option -showdestinations, and it will print valid options for you to pick from:

xcodebuild -showdestinations -workspace Register.xcworkspace -scheme ThatTestTarget

I tried almost anything above, including restarting XCode, none of them worked for me. I solved this problem by simply restarting my Mac. Yes, the classic solution.

A side note: This problem occurred to my XCode after it requested my Mac password from me, probably after an automatic upgrade.


나는 완전히 다른 문제가 있었다. 어떤 이유로 내 앱 " 디바이스 "는 아이폰이 아닌 유니버설 빌드로 설정되었습니다 . iPhone으로 전환했을 때 모든 것이 작동했습니다. 추가 설정이 필요하지 않았습니다.


이것은 나를 위해 일했습니다.

다른 구성표를 위해 이미 구축 한 장치에서 실행하려고합니다. 이동

제품> 청소.

그런 다음 활성 구성표에서 선택한 장치로 빌드하십시오.

참고 URL : https://stackoverflow.com/questions/33747828/a-build-only-device-cannot-be-used-to-run-this-target

반응형