IPhoneInteropSimulatorBase.prototype.launch = function (appPath, applicationIdentifier) { var sessionDelegate = this.setupSessionDelegate(appPath, applicationIdentifier); var appSpec = this.getClassByName("DTiPhoneSimulatorApplicationSpecifier")("specifierWithApplicationPath", $(appPath)); var config = this.getClassByName("DTiPhoneSimulatorSessionConfig")("alloc")("init")("autorelease"); config("setApplicationToSimulateOnStart", appSpec); config("setSimulatedApplicationShouldWaitForDebugger", options.waitForDebugger); var sdkVersion = options.sdkVersion || options.sdk; var sdkRoot = sdkVersion ? $(this.getSdkRootPathByVersion(sdkVersion)) : this.getClassByName("DTiPhoneSimulatorSystemRoot")("defaultRoot"); config("setSimulatedSystemRoot", sdkRoot); this.validateDevice(); this.simulator.setSimulatedDevice(config); if (options.logging) { var logPath = this.createLogPipe(appPath).wait(); fs.createReadStream(logPath, { encoding: "utf8" }).pipe(process.stdout); config("setSimulatedApplicationStdErrPath", $(logPath)); config("setSimulatedApplicationStdOutPath", $(logPath)); } else { if (options.stderr) { config("setSimulatedApplicationStdErrPath", $(options.stderr)); } if (options.stdout) { config("setSimulatedApplicationStdOutPath", $(options.stdout)); } } if (options.args) { var args = options.args.trim().split(/\s+/); var nsArgs = $.NSMutableArray("array"); args.forEach(function (x) { return nsArgs("addObject", $(x)); }); config("setSimulatedApplicationLaunchArgs", nsArgs); } config("setLocalizedClientName", $("ios-sim-portable")); var sessionError = new Buffer(""); var timeoutParam = this.getTimeout(); var time = $.NSNumber("numberWithDouble", timeoutParam); var timeout = time("doubleValue"); var session = this.getClassByName("DTiPhoneSimulatorSession")("alloc")("init")("autorelease"); var delegate = sessionDelegate("alloc")("init"); session("setDelegate", delegate); if (!session("requestStartWithConfig", config, "timeout", timeout, "error", sessionError)) { errors.fail("Could not start simulator session ", sessionError); } };
boolTo$Number: function(bool) { return $.NSNumber('alloc')('initWithBool', bool); },