Skip to content

Xcode 15+ wrong path to iOS runtime #44

Open
@amidaleet

Description

@amidaleet

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions