Skip to content

Xcode 15+ wrong path to iOS runtime #44

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

Open
amidaleet opened this issue Mar 10, 2025 · 0 comments
Open

Xcode 15+ wrong path to iOS runtime #44

amidaleet opened this issue Mar 10, 2025 · 0 comments

Comments

@amidaleet
Copy link

Problem is unfixed in latests gem version (1.6.10)

Simctl had been refactored with Xcode 15 release. Separated from the Xcode.app bundle.
Runtime directory moved to user folder. New path includes part with iOS runtime "version" folder, it may be retrieved from xcrun simctl runtime list output.

Xcode 15 path example:
/Library/Developer/CoreSimulator/Volumes/iOS_21A5326a/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.0.simruntime

Xcode 14.3.1 path example:
/Applications/Xcode-14.3.1.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime

I've overwritten runtime_profiles() getter to fix my fastlane setup (see code below).
It fixes SimCtl calls that I use, such as: reset_device(), runtime(), deviceType().

Although I am not sure whether this diff is enough to implement full support for Xcode 15+ properly.

SimCtl::Xcode::Path.class_eval do
  def self.runtime_profiles
    if SimCtl::Xcode::Version.gte?('15.0')
      output = `xcrun simctl runtime list -v -j`
      json = JSON.parse(output)
      json.each do |r|
        runtime_json = r[1]
        next unless runtime_json['version'] == SD_SPEC::IOS_SIMULATOR_RUNTIME_VERSION

        simruntime_path = runtime_json['runtimeBundlePath']
        return File.dirname(simruntime_path)
      end
      raise "Not found #{SD_SPEC::IOS_SIMULATOR_RUNTIME_VERSION} in #{json}"
    elsif SimCtl::Xcode::Version.gte?('11.0')
      File.join(home, 'Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/')
    elsif SimCtl::Xcode::Version.gte?('9.0')
      File.join(home, 'Platforms/iPhoneOS.platform/Developer/Library/CoreSimulator/Profiles/Runtimes/')
    else
      File.join(home, 'Platforms/iPhoneSimulator.platform/Developer/Library/CoreSimulator/Profiles/Runtimes/')
    end
  end
end
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

No branches or pull requests

1 participant