Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why is ios-deploy required for plain builds (without deployment)? #420

Closed
oliversalzburg opened this issue Sep 27, 2018 · 22 comments · Fixed by #1313
Closed

Why is ios-deploy required for plain builds (without deployment)? #420

oliversalzburg opened this issue Sep 27, 2018 · 22 comments · Fixed by #1313

Comments

@oliversalzburg
Copy link
Contributor

Why am I seeing this complaint when I'm not even trying to deploy? This happens on cordova build:

CordovaError: Promise rejected with non-error: 'ios-deploy was not found. Please download, build and install version 1.9.2 or greater from https://github.com/phonegap/ios-deploy into your path, or do \'npm install -g ios-deploy\''
@janpio
Copy link
Member

janpio commented Sep 27, 2018

My guess is this happens because of a "global" requirement check, triggered by this code:

function checkTool (tool, minVersion, message, toolFriendlyName) {
toolFriendlyName = toolFriendlyName || tool;
// Check whether tool command is available at all
let tool_command = shell.which(tool);
if (!tool_command) {
return Q.reject(toolFriendlyName + ' was not found. ' + (message || ''));
}

Can you post more of your output (and stacktrace if available) so we can better track this down?

@janpio janpio added the info-needed Further information is requested label Sep 27, 2018
@brodycj
Copy link
Contributor

brodycj commented Sep 27, 2018

I get the following results from running cordova build ios with no ios-deploy installed:

CordovaError: Promise rejected with non-error: 'ios-deploy was not found. Please download, build and install version 1.9.2 or greater from https://github.com/phonegap/ios-deploy into your path, or do \'npm install -g ios-deploy\''
    at cli.catch.err (/Users/brodybits/.nvs/node/8.12.0/x64/lib/node_modules/cordova/bin/cordova:29:15)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:189:7)

I am marking this as a bug since I think ios-deploy which has viral GPL v3 license should not be required to build an app from the command line.

I think we should make some better distinction between required build tools and recommended build tools.

@janpio
Copy link
Member

janpio commented Sep 27, 2018

It is required to deploy to iOS devices. I don't think there is a distinction if a requirement is for building or running (or there even should be).

@oliversalzburg
Copy link
Contributor Author

oliversalzburg commented Sep 27, 2018

Here is more log output:

$ cordova build --debug --device ios
Copying '/Users/hartwigdev/builds/f083891d/0/fairmanager/mobile2/.build/build-extras.gradle' to '/Users/hartwigdev/builds/f083891d/0/fairmanager/platforms/android/build-extras.gradle'.
Analyzing repo in '/Users/hartwigdev/builds/f083891d/0/fairmanager/mobile2/platforms/ios/FairManager'.
Android platform isn't being prepared. Not setting build number.
4773 commits found on current branch.
New iOS build number will be '4773'
new pbx project written with localization groups
/Users/hartwigdev/builds/f083891d/0/fairmanager/mobile2/platforms/ios purged from project cache
IOS project Code Sign Entitlements now set to: FairManager/Resources/FairManager.entitlements
Entitlements file is in reference section.
Reading build config file:
Reading build config file:
CordovaError: Promise rejected with non-error: 'ios-deploy was not found. Please download, build and install version 1.9.2 or greater from https://github.com/phonegap/ios-deploy into your path, or do \'npm install -g ios-deploy\''
    at cli.catch.err (/Users/hartwigdev/.npm-global/lib/node_modules/cordova/bin/cordova:29:15)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:188:7)
ERROR: Job failed: exit status 1

@oliversalzburg
Copy link
Contributor Author

oliversalzburg commented Sep 27, 2018

My guess is this is the culprit:

return check_reqs.check_ios_deploy();

will then invoke check_reqs.run(), which might as well also check for ios-deploy as well and then the check_reqs.check_ios_deploy(); could be dropped, right?

@brodycj
Copy link
Contributor

brodycj commented Sep 27, 2018

@oliversalzburg I think you did identify the right "culprit", not so sure that I would follow your logic concerning check_reqs.run() 100%. I think check_reqs.run() which checks for xcodebuild tool would be used for both simulator and device.

Considering that check_reqs.check_ios_deploy() is also called in

return check_reqs.check_ios_deploy();

a quick solution could be to simply remove check_reqs.check_ios_deploy() check from:

return check_reqs.check_ios_deploy();

The downside of this quick solution is that it would lead to a case where an attempt to do cordova run ios --device with no ios-deploy installed would first do the build and then fail with the "ios-deploy was not found" error.

I think a better solution would be to adapt cordova-lib and cordova-ios so that an attempt to do cordova run ios --device with no --nobuild option would somehow check the result of check_reqs.check_ios_deploy() before attempting to build and run. This kind of solution would definitely need an adaptation to https://github.com/apache/cordova-lib/blob/master/src/cordova/run.js. I think the hard part would be getting the interface between cordova-lib and cordova-ios right.

I cannot promise when I would personally have time to work on this one. I suspect the other cordova-ios experts are pretty busy right now. PRs on cordova-lib and cordova-ios for review would be very welcome.

@oliversalzburg
Copy link
Contributor Author

Doesn't this piece already take care of the identical check for cordova run ios?

return check_reqs.check_ios_deploy();

And that check happens before the project would be built prior to deployment. It seems to me like that check in build.js just needs to be removed.

@ghost
Copy link

ghost commented Dec 16, 2018

Why does https://github.com/phonegap/ios-deploy redirect to https://github.com/ios-control/ios-deploy. Was there an ownership switch. I am very confused. Also since it is as @brodybits said GPL v3 does that mean you have to abide by the guidelines just for building your app with ios-deploy

reck1610 pushed a commit to reck1610/cordova-ios that referenced this issue Jan 3, 2019
reck1610 pushed a commit to reck1610/cordova-ios that referenced this issue Jan 3, 2019
reck1610 pushed a commit to reck1610/cordova-ios that referenced this issue Jan 3, 2019
reck1610 pushed a commit to reck1610/cordova-ios that referenced this issue Jan 3, 2019
reck1610 pushed a commit to reck1610/cordova-ios that referenced this issue Jan 3, 2019
@shishirshettygit
Copy link

All I had to do was disconnect my real device (iPhone X) from my Mac.

@jannikco
Copy link

All I had to do was disconnect my real device (iPhone X) from my Mac.

F**K! It works. I was getting mad over this. Thank you so much!

"** BUILD SUCCEEDED **" 💪

@AlexAstilean
Copy link

All I had to do was disconnect my real device (iPhone X) from my Mac.

I just spent over 2 hours trying to find a solution. This was the real problem.

Thank you so much !

@brodycj
Copy link
Contributor

brodycj commented Jul 9, 2019

Why does https://github.com/phonegap/ios-deploy redirect to https://github.com/ios-control/ios-deploy. Was there an ownership switch.

Yes. As you likely know, Cordova was originally born as PhoneGap. PhoneGap was mostly renamed as Cordova in order to avoid trademark issues in the Apache project. I think the iOS tools were moved to a separate org to keep them independently under other licenses. They still use PhoneGap for PhoneGap Build and other tools by Adobe. And the confusing part is that they made a PhoneGap CLI which is a copy of the Cordova CLI. @shazron and @purplecabbage could probably explain this better.

@brodycj
Copy link
Contributor

brodycj commented Jul 9, 2019

All I had to do was disconnect my real device (iPhone X) from my Mac.

I just spent over 2 hours trying to find a solution. […]

I just created and added the help wanted label, hope we can get this one fixed soon. I would likely favor my “better solution” that I proposed in #420 (comment).

@brodycj brodycj added discussion support and removed info-needed Further information is requested labels Jul 15, 2019
@jpike88
Copy link

jpike88 commented Jul 19, 2019

argh just ran into this... thank god someone told me I had to unplug my iPad. was about to go down a rabbit hole

@BrianRosamilia
Copy link

BrianRosamilia commented Jul 19, 2019

I almost never clone+fix global packages to deal with issues like this, so I added this to my readme instead. It's instructions on how to remove this line since it's a bit annoying for my personal workflow.


Fix phone plugged in testing

mdfind check_reqs.check_ios_deploy

Comment out line in any build.js


Should be totally safe since the return value is actually never used (and mdfind is super fast 🥇). Hope this helps someone!

@maxegghead
Copy link

-> BrianRosamilia
Thanks for this, really useful, much better to be able to run new builds without keep unplugging my phone. Especially as every time I plug in my phone I get asked if I trust my macbook, and have to type in my 6 digit lock code (slowly as the screen keyboard can't keep up with a fast rate of typing). sheesh Apple.

@jpike88
Copy link

jpike88 commented Dec 30, 2019

@maxegghead do yourself the favour and remove the need to ever test Cordova outputs on a real device, just deploy to a beta testing platform instead. I wrote a whole build pipeline composed of fuse-box tasks with some Cordova cli calls to upload the build to TestFlight etc. It’s somehow much smoother than trying to test on device

@mattfroese
Copy link

All I had to do was disconnect my real device (iPhone X) from my Mac.

F**K! It works. I was getting mad over this. Thank you so much!

"** BUILD SUCCEEDED **" 💪

My gosh. Thank you. This worked for me.

@donni106
Copy link

donni106 commented Apr 30, 2020

All I had to do was disconnect my real device (iPhone X) from my Mac.

:o wow, so glad to found your comment @shishirshettygit

@Hussain-AboAlamal
Copy link

All I had to do was disconnect my real device (iPhone X) from my Mac.

thanks a lot, you saved my day

@pranayreddy123
Copy link

pranayreddy123 commented Sep 2, 2020

closed xcode and ran 'ionic cordova build ios' in vscode. it worked for me

@Mehuge
Copy link

Mehuge commented Dec 2, 2020

This issue also breaks the code signing settings in the project. Specifically, if I build the project with a device plugged in, the build fails with the promise rejection, the resulting project code signing settings are broken. No team is selected and Xcode displays a warning about having mixed code signing settings.

Unplug the phone, build, and the xcode project signing settings are correctly defined.

@dpogue dpogue added this to the 8.0.0 milestone Aug 29, 2024
dpogue added a commit to dpogue/cordova-ios that referenced this issue Aug 29, 2024
If neither `--device` nor `--emulator` are specified for the build
command, it will check for a connected device and assume `--device` if
one is found. However, it was also checking for the availability of the
ios-deploy tool which is used to deploy to a connected device.

If we're just building, we don't need to check for a deploy tool. The
run command already has this check to ensure that ios-deploy is
available before actually trying to deploy.

Closes apacheGH-420.
Closes apacheGH-677.
dpogue added a commit to dpogue/cordova-ios that referenced this issue Aug 30, 2024
If neither `--device` nor `--emulator` are specified for the build
command, it will check for a connected device and assume `--device` if
one is found. However, it was also checking for the availability of the
ios-deploy tool which is used to deploy to a connected device.

If we're just building, we don't need to check for a deploy tool. The
run command already has this check to ensure that ios-deploy is
available before actually trying to deploy.

Closes apacheGH-420.
Closes apacheGH-677.
dpogue added a commit that referenced this issue Aug 30, 2024
* feat!: Support for Catalyst builds

`cordova build ios --device --target=mac ...`

Output is to `build/Debug-maccatalyst`

* fix: Disable iPad-on-Mac builds in favour of Catalyst

Xcode warns that only one can be enabled at a time, so we need to pick
one, and Catalyst seems like the better option for a proper macOS app
experience.

* feat!: Enable compiling for Apple Vision platform

* chore(ci): Add unit tests for run and Catalyst stuff

* fix(build): Don't check for ios-deploy at build time

If neither `--device` nor `--emulator` are specified for the build
command, it will check for a connected device and assume `--device` if
one is found. However, it was also checking for the availability of the
ios-deploy tool which is used to deploy to a connected device.

If we're just building, we don't need to check for a deploy tool. The
run command already has this check to ensure that ios-deploy is
available before actually trying to deploy.

Closes GH-420.
Closes GH-677.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.