Method: RunLoop::Lipo#expect_compatible_arch

Defined in:
lib/run_loop/lipo.rb

#expect_compatible_arch(device) ⇒ Object

Note:

At the moment, we are focusing on simulator compatibility. Since we don’t have an automated way of installing an .ipa on local device, we don’t require an .ipa path. Without an .ipa path, we cannot verify the architectures. Further, we would need to adopt a third-party tool like ideviceinfo to find the target device’s instruction set.

Inspect the CFBundleExecutable in the app bundle path with lipo and compare the result with the target device’s instruction set.

Simulators

If the target is a simulator and the binary contains an i386 slice, the app will launch on the 64-bit simulators.

If the target is a simulator and the binary contains only an x86_64 slice, the app will not launch on these simulators:

“‘ iPhone 4S, iPad 2, iPhone 5, and iPad Retina. “`

All other simulators are 64-bit.

Devices

“‘ armv7 <== 3gs, 4s, iPad 2, iPad mini, iPad 3, iPod 3, iPod 4, iPod 5 armv7s <== 5, 5c, iPad 4 arm64 <== 5s, 6, 6 Plus, Air, Air 2, iPad Mini Retina, iPad Mini 3 “`

Raises:

  • (RuntimeError)

    Raises an error if the device is a physical device.

  • (RunLoop::IncompatibleArchitecture)

    Raises an error if the instruction set of the target device is not compatible with the executable in the application.

See Also:



71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# File 'lib/run_loop/lipo.rb', line 71

def expect_compatible_arch(device)
  if device.physical_device?
    raise 'Ensuring compatible arches for physical devices is NYI'
  else
    arches = self.info
    # An i386 binary will run on any simulator.
    return true if arches.include?('i386')

    instruction_set = device.instruction_set
    unless arches.include?(instruction_set)
      raise RunLoop::IncompatibleArchitecture,
            ['Binary at:',
             binary_path,
             'does not contain a compatible architecture for target device.',
             "Expected '#{instruction_set}' but found #{arches}."].join("\n")
    end
  end
end