Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-12822] iOS: Simulator appears then exits

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2013-05-17T22:08:07.000+0000
Affected Version/sRelease 3.0.0, Release 3.0.2
Fix Version/s2013 Sprint 10 API, 2013 Sprint 10, Release 3.1.1, Release 3.2.0
ComponentsiOS
Labelsqe-closed-3.1.1, triage
ReporterSusan Crayne
AssigneeSabil Rahim
Created2013-01-04T10:55:39.000+0000
Updated2013-05-20T17:40:39.000+0000

Description

*Problem description* Run app, iOS simulator appears then exits with the error below. *Workaround* "iOS Simulator -> Reset Content and Settings...", or manually delete app from simulator. *Part log (3.0.2 GA)*
[ERROR] :  An error occurred running the iOS Simulator
[ERROR] :  [DEBUG] Sessiocould not be started: Error Domain=DTiPhoneSimulatorErrorDomain Code=1 "iOS Simulator failed to install the application." UserInfo=0x101885f90 {NSLocalizedDescription=iOS Simulator failed to install the application., DTiPhoneSimulatorUnderlyingErrorCodeKey=-1}
*Part log (old)*
[DEBUG] Session could not be started: Error Domain=DTiPhoneSimulatorErrorDomain Code=2 "Simulator session timed out." UserInfo=0x10013bea0 {NSLocalizedDescription=Simulator session timed out.}
*Full log (old)*
INFO] One moment, building ...
[DEBUG] Detecting modules in /Users/susancrayne/Documents/Titanium Studio Workspace/IOS6test/modules
[DEBUG] Detecting modules in /Library/Application Support/Titanium/modules
[DEBUG] Detected module for android: ti.cloudpush 2.0.7 @ /Library/Application Support/Titanium/modules/android/ti.cloudpush/2.0.7
[DEBUG] Detected module for android: ti.cloudpush 2.0.5 @ /Library/Application Support/Titanium/modules/android/ti.cloudpush/2.0.5
[DEBUG] Detected module for android: ti.cloudpush 2.0.1 @ /Library/Application Support/Titanium/modules/android/ti.cloudpush/2.0.1
[DEBUG] Detected module for commonjs: ti.cloud 2.3.0 @ /Library/Application Support/Titanium/modules/commonjs/ti.cloud/2.3.0
[DEBUG] Detected module for commonjs: ti.cloud 2.1.0 @ /Library/Application Support/Titanium/modules/commonjs/ti.cloud/2.1.0
[DEBUG] Detected module for commonjs: ti.cloud 2.0.5 @ /Library/Application Support/Titanium/modules/commonjs/ti.cloud/2.0.5
[DEBUG] Detected module for commonjs: ti.cloud 2.0.1 @ /Library/Application Support/Titanium/modules/commonjs/ti.cloud/2.0.1
[DEBUG] Looking for Titanium Module id: ti.cloud, version: 2.3.0, platform: commonjs
[INFO] Titanium SDK version: 3.0.0 (12/12/12 18:49 a5894b3)
[INFO] iPhone Device family: universal
[INFO] iPhone SDK version: 6.0
[INFO] iPhone simulated device: iphone
[DEBUG] linking: /Users/susancrayne/Documents/Titanium Studio Workspace/IOS6test/Resources/app.js to /Users/susancrayne/Documents/Titanium Studio Workspace/IOS6test/build/iphone/build/Debug-iphonesimulator/IOS6test.app/app.js
[DEBUG] linking: /Users/susancrayne/Documents/Titanium Studio Workspace/IOS6test/Resources/KS_nav_ui.png to /Users/susancrayne/Documents/Titanium Studio Workspace/IOS6test/build/iphone/build/Debug-iphonesimulator/IOS6test.app/KS_nav_ui.png
[DEBUG] linking: /Users/susancrayne/Documents/Titanium Studio Workspace/IOS6test/Resources/KS_nav_views.png to /Users/susancrayne/Documents/Titanium Studio Workspace/IOS6test/build/iphone/build/Debug-iphonesimulator/IOS6test.app/KS_nav_views.png
[DEBUG] linking: /Users/susancrayne/Documents/Titanium Studio Workspace/IOS6test/Resources/iphone/appicon.png to /Users/susancrayne/Documents/Titanium Studio Workspace/IOS6test/build/iphone/build/Debug-iphonesimulator/IOS6test.app/appicon.png
[DEBUG] linking: /Users/susancrayne/Documents/Titanium Studio Workspace/IOS6test/Resources/iphone/Default-568h@2x.png to /Users/susancrayne/Documents/Titanium Studio Workspace/IOS6test/build/iphone/build/Debug-iphonesimulator/IOS6test.app/Default-568h@2x.png
[DEBUG] linking: /Users/susancrayne/Documents/Titanium Studio Workspace/IOS6test/Resources/iphone/Default-Landscape.png to /Users/susancrayne/Documents/Titanium Studio Workspace/IOS6test/build/iphone/build/Debug-iphonesimulator/IOS6test.app/Default-Landscape.png
[DEBUG] linking: /Users/susancrayne/Documents/Titanium Studio Workspace/IOS6test/Resources/iphone/Default-Portrait.png to /Users/susancrayne/Documents/Titanium Studio Workspace/IOS6test/build/iphone/build/Debug-iphonesimulator/IOS6test.app/Default-Portrait.png
[DEBUG] linking: /Users/susancrayne/Documents/Titanium Studio Workspace/IOS6test/Resources/iphone/Default.png to /Users/susancrayne/Documents/Titanium Studio Workspace/IOS6test/build/iphone/build/Debug-iphonesimulator/IOS6test.app/Default.png
[DEBUG] linking: /Users/susancrayne/Documents/Titanium Studio Workspace/IOS6test/Resources/iphone/Default@2x.png to /Users/susancrayne/Documents/Titanium Studio Workspace/IOS6test/build/iphone/build/Debug-iphonesimulator/IOS6test.app/Default@2x.png
[INFO] Minimum iOS version: 4.3 Linked iOS Version 6.0
[DEBUG] executing command: /usr/bin/killall ios-sim
[DEBUG] No matching processes belonging to you were found
[DEBUG] executing command: /usr/bin/killall iPhone Simulator
[DEBUG] No matching processes belonging to you were found
[DEBUG] finding old log files
[INFO] Launching application in Simulator
[INFO] Launched application in Simulator (88.61 seconds)
[INFO] Application has exited from Simulator
[DEBUG] Session could not be started: Error Domain=DTiPhoneSimulatorErrorDomain Code=2 "Simulator session timed out." UserInfo=0x10013bea0 {NSLocalizedDescription=Simulator session timed out.}

Attachments

FileDateSize
app.js2013-01-04T10:55:39.000+00001339
tiapp.xml2013-01-04T11:00:06.000+00002554

Comments

  1. Susan Crayne 2013-01-04

    The only way I can reliably run an app is to manually run the IOS Simulator, Reset Contents and Settings, then run the app.
  2. Daniel Sefton 2013-01-15

    I also ran into this, so I know that feel. But it works for me now. What Xcode version are you using, and is there any reason you can't update your Studio to 3.0?
  3. Susan Crayne 2013-01-15

    The XCode version is 4.5.2 (4G2008a). I updated Studio to Titanium Studio, build: 3.0.1.201212181159 Build: jenkins-titanium-rcp-master-350 (origin/master) Date: 18 December 2012, 12:04:42 Error message is:
       [ERROR] :  [DEBUG] Sessiocould not be started: Error Domain=DTiPhoneSimulatorErrorDomain Code=2 "Simulator session timed out." UserInfo=0x1001adc90 {NSLocalizedDescription=Simulator session timed out.}
       
  4. Susan Crayne 2013-01-15

    After cleaning the project, the simulator consistently appears and does not exit.
  5. Olga Romero 2013-03-18

    TIMOB-13103 - CLI: Intermittent simulator failure I cannot reproduce this issue. Tested with: Titanium Studio, build: 3.1.0.201303141941 Titanium SDK, build: 3.1.0.v20130318141656 CLI 3.0.25 iPhone 6.1 simulator
  6. Olga Romero 2013-03-19

    I ran in to this issue again with: Titanium Studio, build: 3.1.0.201303182358 Titanium SDK, build: 3.1.0.v20130319125050 CLI 3.0.25 Test steps: 1. Created project and ran on simulator (1st attempt)- succeeded 2. Changed app name in tiapp.xml, cleaned the project and tried to run as simulator (2nd attempt)- failed 3. Repeated step 3-failed Note: I noticed this issue occurs consistently if the app's name changed in tiapp.xml It does not matter if the build folder is deleted and the project is cleaned. [ERROR] :  An error occurred running the iOS Simulator [ERROR] :  [DEBUG] Session could not be started: Error Domain=DTiPhoneSimulatorErrorDomain Code=1 "iOS Simulator failed to install the application." UserInfo=0x7fcbbb871990 {NSLocalizedDescription=iOS Simulator failed to install the application., DTiPhoneSimulatorUnderlyingErrorCodeKey=-1} [ERROR] :   [ERROR] :  Project failed to build after 17s 790ms
  7. Matt Mullens 2013-04-15

    The problem is in ios-sim. It is hard-coded (!) to timeout at 30s. The following procedure unceremoniously pilfered and slightly modified from an enterprising young patch of about 12 days in age to the phone gap branch of the ios-sim fixes the problem. Steps: 1. git clone https://github.com/appcelerator/ios-sim.git 2. Apply this patch (I do not see an attachment button for comments in Ira):
       
       --- ios-sim/Source/iPhoneSimulator.m	2013-04-15 09:52:07.000000000 -0700
       +++ ios-sim-patched/Source/iPhoneSimulator.m	2013-04-15 09:55:41.000000000 -0700
       @@ -46,6 +46,7 @@
          fprintf(stderr, "  --setenv NAME=VALUE             Set an environment variable\n");
          fprintf(stderr, "  --stdout <stdout file path>     The path where stdout of the simulator will be redirected to (defaults to stdout of ios-sim)\n");
          fprintf(stderr, "  --stderr <stderr file path>     The path where stderr of the simulator will be redirected to (defaults to stderr of ios-sim)\n");
       +  fprintf(stderr, "  --timeout <seconds>             The timeout time to wait for a response from the Simulator. Default value: 30 seconds\n");
          fprintf(stderr, "  --args <...>                    All following arguments will be passed on to the application\n");
        }
        
       @@ -187,6 +188,7 @@
                                         environment:(NSDictionary *)environment
                                          stdoutPath:(NSString *)stdoutPath
                                          stderrPath:(NSString *)stderrPath
       +				  timeout:(NSTimeInterval)timeout
                                                args:(NSArray *)args {
          DTiPhoneSimulatorApplicationSpecifier *appSpec;
          DTiPhoneSimulatorSessionConfig *config;
       @@ -263,7 +265,7 @@
            [session setUuid:uuid];
          }
        
       -  if (![session requestStartWithConfig:config timeout:30 error:&error]) {
       +  if (![session requestStartWithConfig:config timeout:timeout error:&error]) {
            nsprintf(@"Could not start simulator session: %@", error);
            return EXIT_FAILURE;
          }
       @@ -311,6 +313,7 @@
            NSString *uuid = nil;
            NSString *stdoutPath = nil;
            NSString *stderrPath = nil;
       +    NSTimeInterval timeout = 30;
            NSMutableDictionary *environment = [NSMutableDictionary dictionary];
            int i = numOfArgs;
            for (; i < argc; i++) {
       @@ -368,7 +371,11 @@
                i++;
                stderrPath = [[NSString stringWithUTF8String:argv[i]] expandPath];
                NSLog(@"stderrPath: %@", stderrPath);
       -      } else if (strcmp(argv[i], "--args") == 0) {
       +     } else if (strcmp(argv[i], "--timeout") == 0) {
       +        i++;
       +        timeout = [[NSString stringWithUTF8String:argv[i]] doubleValue];
       +        NSLog(@"Timeout: %f second(s)", timeout);
       +    } else if (strcmp(argv[i], "--args") == 0) {
                i++;
                break;
              } else if (strcmp(argv[i], "--retina") == 0) {
       @@ -397,6 +404,7 @@
                environment:environment
                 stdoutPath:stdoutPath
                 stderrPath:stderrPath
       +         timeout:timeout 
                       args:args];
          } else {
            if (argc == 2 && strcmp(argv[1], "--help") == 0) {
       
       
    3. rake install from the ios-sim root dir which creates an "ios-sim/build/Release/" 4. mv "/Library/Application Support/Titanium/mobilesdk/osx/3.0.2.GA/iphone/ios-sim" "/Library/Application Support/Titanium/mobilesdk/osx/3.0.2.GA/iphone/ios-sim.old" 5. cp "ios-sim/build/Release/ios-sim" "/Library/Application Support/Titanium/mobilesdk/osx/3.0.2.GA/iphone" 6. Last but not least, for a 5 minute simulator timeout, apply the patch below to the file: "/Library/Application Support/Titanium/mobilesdk/osx/3.0.2.GA/iphone/cli/hooks/run.js" Hopefully you don't need that much time, but it sure does suck to wait 4:59 only to have the simulator exit out on you, doesn't it? I feel your pain - I've recently been forced to make Titanium run in a VM configuration that violates virtually every related TOS on a somewhat underpowered laptop.
       
       --- run.js      2013-04-15 09:37:28.000000000 -0700
       +++ run.js.new  2013-04-15 09:35:59.000000000 -0700
       @@ -71,7 +71,9 @@
                                                       '--sdk',
                                                       build.iosSimVersion,
                                                       '--family',
       -                                               build.iosSimType
       +                                               build.iosSimType,
       +                                               '--timeout',
       +                                               360
                                               ],
                                               findLogTimer,
                                               simActivateTimer = setTimeout(function () {
       
       
    Rgds....Matt
  8. Daniel Sefton 2013-04-15

    Nice, thanks Matt! This issue has been driving me crazy for months :)
  9. Matt Mullens 2013-04-15

    My pleasure, I just noticed that the patch I posted in was messed up in the code block of the comment - please check this one out instead - I just edited it.
  10. Susan Crayne 2013-05-07

    When I apply this patch, I get this error message: corrupt patch at line 56
  11. Matt Mullens 2013-05-08

    Hi Susan, you tried the patch from the directory containing (above) the ios-sim directory? I'm on linux, and utilize diff to create the patch, so I patch using patch like this: patch < ios-sim.patch Not sure if our tools are different. It could also be that my version of ios-sim's iPhoneSimulator.m is different for some reason? I don't have the VM fired up at the moment so I can't take a look right now, but if our versions are different then it may be required to go through line by line and apply the patch manually, if memory serves I was on 3.0.2GA? Edit: yes just looked at my own comments - I was on 3.0.2GA, so that might be important. here's a link to the phonegap branch of ios-sim with their solution from which I worked to apply to the appcelerator version of ios-sim: https://github.com/phonegap/ios-sim/commit/ef30c400c732b73451c7683df1a8088167ae3a24 Oh one other thing to check might be line-endings? Make sure there are no ^M's in there - if for example you pulled the patch down to windows then scp'd it over to a linux system and then applied the patch, the windows system may have applied its crlf garbage, you can use the vi %s/^M//g to remove (ctrl-v ctrl-m gives you the ^M in vi).
  12. Susan Crayne 2013-05-08

    I am running 3.1.0GA. Also this direcotry is in /Users/susancrayne/Library/Application Support/Titanium/mobilesdk/osx, not in /Library/Application Support/Titanium/mobilesdk/osx. Does this mean I need to apply the patch manually? I'm pretty sure I can't install an earlier version.
  13. Matt Mullens 2013-05-09

    Our location difference shouldn't matter to patch as long as the path from that location to the source is the same. I think the best path forward just to avoid any issues is to apply manually - if there is a C developer nearby grab them for help - tell them its 5 minutes and you'll reward them with something sugary, a donut for example - we tend to be pretty simple creatures and are easily motivated by sweet things (half before the work starts, and they only get the other half when its done). Or give it a go yourself if your developers are suffering from rather extreme anti-social personality disorder - a common affliction among us. Here's how: the patch provides the line numbers and a few lines above and below for matching. Each section of change is divided by lines that look like so: "@@ -187,6 +188,7 @@", the first set of numbers (-187,6) means go to the first file (the original) and put your cursor on line 187, the rest of what you see is continuing for 6 lines. The second set of numbers (+188,7) means in another editor, opened with a copy of the file (this is the one that will become the newly patched file - where you make your changes), go to line 187 and take a look at the next 6 lines also (you can deduce that you're about to add a line, because 6+1=7, but you'll see that extra line in the patch prepended with the "+" sign, so no real need to bother with the number after the comma in each set of numbers between the "@@..@@" signs). So now you are in the right place in both files. Note that there are not necessarily 6 or 7 lines of change, but that's what the patch is showing you below the @@...@@ line to the next @@...@@ line. Between the "@@...@@" lines, the + lines are for lines that were added to the original file to get to the new file, - lines are for those that were removed from the original to get to the new one and lines with no + or - are lines aren't to be changed but just used for context around what has changed so you can get a sense of whether the change is right or not - really just a visual indicator of "Oh yeah, I'm doing the right thing here" or not. Anyway hope that helps!
  14. Susan Crayne 2013-05-09

    Thanks for the info. I've done development in C; I can apply the patch.
  15. Matt Mullens 2013-05-09

    Great! Well I can't seem to get a JIRA comment to look right to save my life so if you get a ton of emails, I apologize for all of the edits!!
  16. Olga Romero 2013-05-20

    Tested with: Appcelerator Studio, build: 3.1.1.201305181057 SDK, build: 3.1.1.v20130517185716 iOS 6.0 simulator(retina/non_retina), 6.1, 5.1 Test steps: Create a project Run as iOS 6.0 simulator (either retina or non_retina), 6.1;5.1 Actual result: Simulator launches successfully

JSON Source