motion/core/ios/device.rb in bubble-wrap-1.9.4 vs motion/core/ios/device.rb in bubble-wrap-1.9.5
- old
+ new
@@ -39,11 +39,19 @@
def rear_camera?(picker=UIImagePickerController)
p "This method (rear_camera?) is DEPRECATED. Transition to using Device.camera.rear?"
picker.isCameraDeviceAvailable(UIImagePickerControllerCameraDeviceRear)
end
+ # Return whether app is being run in simulator
+ # @return [TrueClass, FalseClass] true will be returned if simulator, false otherwise.
def simulator?
- @simulator_state ||= !NSBundle.mainBundle.bundlePath.start_with?('/var/')
+ @simulator_state ||= begin
+ if ios_version.to_i >= 9
+ !NSBundle.mainBundle.bundlePath.start_with?('/var/')
+ else
+ !(UIDevice.currentDevice.model =~ /simulator/i).nil?
+ end
+ end
end
# Returns the IOS SDK version currently running (i.e. "5.1" or "6.0" etc)
# @return [String] the IOS SDK version currently running
def ios_version