mirror of
https://github.com/zhigang1992/RubyMotion.git
synced 2026-04-22 20:18:57 +08:00
[sim] Make app launch again with Xcode 5.1.
Fixes http://hipbyte.myjetbrains.com/youtrack/issue/RM-365
This commit is contained in:
24
bin/sim.m
24
bin/sim.m
@@ -1274,7 +1274,7 @@ main(int argc, char **argv)
|
||||
[[NSAutoreleasePool alloc] init];
|
||||
|
||||
#if defined(SIMULATOR_IOS)
|
||||
# define MIN_ARGS 6
|
||||
# define MIN_ARGS 7
|
||||
#else
|
||||
# define MIN_ARGS 4
|
||||
#endif
|
||||
@@ -1290,6 +1290,7 @@ main(int argc, char **argv)
|
||||
debug_mode = atoi(argv[argv_n++]);
|
||||
#if defined(SIMULATOR_IOS)
|
||||
NSNumber *device_family = [NSNumber numberWithInt:atoi(argv[argv_n++])];
|
||||
NSString *device_name = [[NSString stringWithUTF8String:argv[argv_n++]] retain];
|
||||
#endif
|
||||
sdk_version = [[NSString stringWithUTF8String:argv[argv_n++]] retain];
|
||||
#if defined(SIMULATOR_IOS)
|
||||
@@ -1304,8 +1305,12 @@ main(int argc, char **argv)
|
||||
}
|
||||
|
||||
#if defined(SIMULATOR_IOS)
|
||||
// Load the framework.
|
||||
[[NSBundle bundleWithPath:[xcode_path stringByAppendingPathComponent:@"Platforms/iPhoneSimulator.platform/Developer/Library/PrivateFrameworks/iPhoneSimulatorRemoteClient.framework"]] load];
|
||||
// Load the frameworks.
|
||||
[[NSBundle bundleWithPath:[xcode_path stringByAppendingPathComponent:@"../SharedFrameworks/DVTFoundation.framework"]] load];
|
||||
[[NSBundle bundleWithPath:[xcode_path stringByAppendingPathComponent:@"Platforms/iPhoneSimulator.platform/Developer/Library/PrivateFrameworks/DVTiPhoneSimulatorRemoteClient.framework"]] load];
|
||||
|
||||
Class Platform = NSClassFromString(@"DVTPlatform");
|
||||
assert(Platform != nil);
|
||||
|
||||
Class AppSpecifier =
|
||||
NSClassFromString(@"DTiPhoneSimulatorApplicationSpecifier");
|
||||
@@ -1371,6 +1376,16 @@ main(int argc, char **argv)
|
||||
}
|
||||
|
||||
#if defined(SIMULATOR_IOS)
|
||||
NSError *error = nil;
|
||||
|
||||
// Initialize the DevTools environment.
|
||||
if (!((BOOL (*)(id, SEL, id *))objc_msgSend)(Platform,
|
||||
@selector(loadAllPlatformsReturningError:), &error)) {
|
||||
fprintf(stderr, "*** Cannot load simulator platforms: %s\n",
|
||||
[[error description] UTF8String]);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
// Create application specifier.
|
||||
id app_spec = ((id (*)(id, SEL, id))objc_msgSend)(AppSpecifier,
|
||||
@selector(specifierWithApplicationPath:), app_path);
|
||||
@@ -1399,6 +1414,8 @@ main(int argc, char **argv)
|
||||
(debug_mode == DEBUG_GDB || getenv("SIM_WAIT_FOR_DEBUGGER") != NULL));
|
||||
((void (*)(id, SEL, id))objc_msgSend)(config,
|
||||
@selector(setSimulatedDeviceFamily:), device_family);
|
||||
((void (*)(id, SEL, id))objc_msgSend)(config,
|
||||
@selector(setSimulatedDeviceInfoName:), device_name);
|
||||
((void (*)(id, SEL, id))objc_msgSend)(config,
|
||||
@selector(setSimulatedSystemRoot:), system_root);
|
||||
((void (*)(id, SEL, id))objc_msgSend)(config,
|
||||
@@ -1442,7 +1459,6 @@ main(int argc, char **argv)
|
||||
delegate);
|
||||
|
||||
// Start session.
|
||||
NSError *error = nil;
|
||||
if (!((BOOL (*)(id, SEL, id, double, id *))objc_msgSend)(session,
|
||||
@selector(requestStartWithConfig:timeout:error:), config, 0.0,
|
||||
&error)) {
|
||||
|
||||
@@ -91,7 +91,7 @@ END
|
||||
end
|
||||
end
|
||||
|
||||
# Prepare the device family.
|
||||
# Prepare the device info.
|
||||
family_int =
|
||||
if family = ENV['device_family']
|
||||
App.config.device_family_int(family.downcase.intern)
|
||||
@@ -99,15 +99,7 @@ END
|
||||
App.config.device_family_ints[0]
|
||||
end
|
||||
retina = ENV['retina']
|
||||
|
||||
# Configure the SimulateDevice variable (the only way to specify if we want to run in retina mode or not).
|
||||
simulate_device = App.config.device_family_string(family_int, target, retina)
|
||||
default_simulator = `/usr/bin/defaults read com.apple.iphonesimulator "SimulateDevice"`.strip
|
||||
if default_simulator != simulate_device && default_simulator != "'#{simulate_device}'"
|
||||
simulate_device = "'#{simulate_device}'" if simulate_device.include?(" ")
|
||||
system("/usr/bin/killall \"iPhone Simulator\" >& /dev/null")
|
||||
system("/usr/bin/defaults write com.apple.iphonesimulator \"SimulateDevice\" \"#{simulate_device}\"")
|
||||
end
|
||||
|
||||
# Launch the simulator.
|
||||
xcode = App.config.xcode_dir
|
||||
@@ -119,7 +111,7 @@ END
|
||||
App.info 'Simulate', app
|
||||
at_exit { system("stty echo") } if $stdout.tty? # Just in case the simulator launcher crashes and leaves the terminal without echo.
|
||||
Signal.trap(:INT) { } if ENV['debug']
|
||||
system "#{env} #{sim} #{debug} #{family_int} #{target} \"#{xcode}\" \"#{app}\" #{app_args}"
|
||||
system "#{env} #{sim} #{debug} #{family_int} '#{simulate_device}' #{target} \"#{xcode}\" \"#{app}\" #{app_args}"
|
||||
App.config.print_crash_message if $?.exitstatus != 0 && !App.config.spec_mode
|
||||
exit($?.exitstatus)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user