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

iOS: Fix running cordova build ios for emulators with Xcode 10.1 (ß) #428

Closed
wants to merge 2 commits into from

Conversation

kashban
Copy link
Contributor

@kashban kashban commented Oct 11, 2018

Xcode's simctl json format has changed with Xcode 10.1, so without this fix "cordova build ios" will fail when built on a mac without a physical device attached to.

New Format running xcrun simctl list --json:

{
        "state" : "Shutdown",
        "isAvailable" : "YES",
        "name" : "iPad Air",
        "udid" : "6A467ED2-BE11-4C79-9B51-39557672C181",
        "availabilityError" : ""
      },

Platforms affected

Mac OS X, iOS

What does this PR do?

Fix scanning for available emulators to build / run against.

What testing has been done on this change?

Tests have been run on a Mac mini with Mac OS X 10.3 and Xcode 10 + Xcode 10.1 ß installed.

Checklist

  • Reported an issue in the JIRA database
    Not possible, because I am unable to create a new issue there. Apache Cordova is not shown in the List of available projects though I am able to search and find for issues on it.

  • Commit message follows the format: "CB-3232: (android) Fix bug with resolving file paths", where CB-xxxx is the JIRA ID & "android" is the platform affected.
    See above.

  • Added automated test coverage as appropriate for this change.

simctl json format changed with Xcode 10.1, so without this fix "cordova build ios" will fail when built on a mac without a physical device attached to.
@codecov-io
Copy link

codecov-io commented Oct 11, 2018

Codecov Report

Merging #428 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #428   +/-   ##
=======================================
  Coverage   74.29%   74.29%           
=======================================
  Files          12       12           
  Lines        1564     1564           
=======================================
  Hits         1162     1162           
  Misses        402      402

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 23a9387...c548d78. Read the comment docs.

Copy link
Member

@dpogue dpogue left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Thanks for opening a PR for this!

I'm going to wait until Xcode 10.1 is released before merging this, just in case they make any more changes between now and then, but I'll make sure this gets into the next cordova-ios major version release :)

@kashban
Copy link
Contributor Author

kashban commented Oct 12, 2018

@dpogue Makes sense, thanks. Let's hope Apple does not anything stupid (again) until then.

@felimoles
Copy link

to downgrade to xcode 10, unistall xcode beta and command line tools beta and reinstall the oficial version?

@kashban
Copy link
Contributor Author

kashban commented Oct 18, 2018

I tried this but no luck.

@mccob
Copy link

mccob commented Oct 23, 2018

** BUILD SUCCEEDED ** with that
thank you :)

@dpogue
Copy link
Member

dpogue commented Oct 30, 2018

Xcode 10.1 is now released. If someone has time to confirm that this works with the release version, I'll get it merged :)

@kashban
Copy link
Contributor Author

kashban commented Oct 31, 2018

Updating xcode now...

@kashban
Copy link
Contributor Author

kashban commented Oct 31, 2018

Good thing waiting for the release. Now the JSON is like this:

  {
        "availability" : "(unavailable, runtime profile not found)",
        "state" : "Shutdown",
        "isAvailable" : false,
        "name" : "Apple TV",
        "udid" : "FE0957D5-9CF2-447D-8CF4-8A376ED9B91E",
        "availabilityError" : "runtime profile not found"
      },

So "availability" is back to be backward compatible while "isAvailable" has been turned into a boolean as I would have expected in the first place.

While there is no need anymore for this PR to fix an actual bug it could be a good idea to check for "isAvailable" if present. Going for "availabiltiy" seemed to be the best possible in the past because no other indicator was present, but from now on we should probably go for "isAvailable".

What's your thoughs about this?

@dpogue
Copy link
Member

dpogue commented Oct 31, 2018

Yeah, I think it makes sense to check for isAvailable (as a boolean), and fallback to availability (as string matching). Unless you can find any cases where they don't match.

@kashban
Copy link
Contributor Author

kashban commented Nov 1, 2018

I will change the PR accordingly (or issue a new one if that isn't possible) when I am back at the office tomorrow.

@kashban
Copy link
Contributor Author

kashban commented Nov 2, 2018

Made a new one: #451

@kashban kashban closed this Nov 2, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants