Problem
Every build I do with iOS for the iOS simulator fails after a modification of any kind. This includes the first time the app is run. The app will run fine if you run it a second time. But if you make changes after that successful run, it will fail again until you attempt to run it twice, effectively doubling the length of time it takes to test applications.
Reproduce
Create new Titanium app (doesn't have to be Alloy, but the problem shows up there as well)
Run the app for the iOS simulator (happens on both regular and debug builds)
The app will fail with the error log listed below. Run it again and it will succeed.
To go further, make any change to the app, perhaps just changing the background color. Run it. It will fail with the same error as before. Run it again and it will succeed. Lather, rinse, repeat.
Error Log
[DEBUG] : No project level plugins to load
[DEBUG] : Loaded plugin hooks:
[DEBUG] : /Users/tlukasavage/Library/Application Support/Titanium/mobilesdk/osx/3.0.0/cli/hooks/plugins.js
[DEBUG] : /Users/tlukasavage/Library/Application Support/Titanium/mobilesdk/osx/3.0.0/iphone/cli/hooks/install.js
[DEBUG] : /Users/tlukasavage/Library/Application Support/Titanium/mobilesdk/osx/3.0.0/iphone/cli/hooks/package.js
[DEBUG] : /Users/tlukasavage/Library/Application Support/Titanium/mobilesdk/osx/3.0.0/iphone/cli/hooks/run.js
[INFO] : Build type: development
[DEBUG] : Titanium iOS SDK directory: /Users/tlukasavage/Library/Application Support/Titanium/mobilesdk/osx/3.0.0/iphone
[DEBUG] : Setting Xcode target to Debug
[DEBUG] : Setting Xcode build OS to iphonesimulator6.0
[DEBUG] : Xcode installation: /Applications/Xcode.app/Contents/Developer
[DEBUG] : iOS WWDR certificate: not found
[DEBUG] : Minimum iOS version: 4.3
[INFO] : Building for target: simulator
[INFO] : Building using iOS SDK: 6.0
[INFO] : Building for iOS Simulator: 6.0
[INFO] : Building for device family: universal
[INFO] : Building for iOS 6.0; using 4.3 as minimum iOS version
[INFO] : Debugging enabled via debug host: 192.168.1.125:58444
[DEBUG] : Building for the following architectures: armv7 armv7s i386
[DEBUG] : Would be firing "compile" legacy plugin hook if it was supported
[INFO] : Building Info.plist
[INFO] : No Titanium Modules required, continuing
[INFO] : Creating symlinks for simulator build
[DEBUG] : Walking directory /Users/tlukasavage/Documents/Titanium Studio Workspace/test1/Resources
[DEBUG] : Symlinking /Users/tlukasavage/Documents/Titanium Studio Workspace/test1/Resources/app.js => /Users/tlukasavage/Documents/Titanium Studio Workspace/test1/build/iphone/build/Debug-iphonesimulator/test1.app/app.js
[DEBUG] : Symlinking /Users/tlukasavage/Documents/Titanium Studio Workspace/test1/Resources/KS_nav_ui.png => /Users/tlukasavage/Documents/Titanium Studio Workspace/test1/build/iphone/build/Debug-iphonesimulator/test1.app/KS_nav_ui.png
[DEBUG] : Symlinking /Users/tlukasavage/Documents/Titanium Studio Workspace/test1/Resources/KS_nav_views.png => /Users/tlukasavage/Documents/Titanium Studio Workspace/test1/build/iphone/build/Debug-iphonesimulator/test1.app/KS_nav_views.png
[DEBUG] : Copying /Users/tlukasavage/Library/Application Support/Titanium/mobilesdk/osx/3.0.0/iphone/modules/facebook/images => /Users/tlukasavage/Documents/Titanium Studio Workspace/test1/build/iphone/build/Debug-iphonesimulator/test1.app/modules/facebook/images
[DEBUG] : Copying /Users/tlukasavage/Library/Application Support/Titanium/mobilesdk/osx/3.0.0/iphone/modules/ui/images => /Users/tlukasavage/Documents/Titanium Studio Workspace/test1/build/iphone/build/Debug-iphonesimulator/test1.app/modules/ui/images
[DEBUG] : Copying /Users/tlukasavage/Documents/Titanium Studio Workspace/test1/Resources/iphone => /Users/tlukasavage/Documents/Titanium Studio Workspace/test1/build/iphone/build/Debug-iphonesimulator/test1.app
[INFO] : No module resources to copy
[INFO] : No CommonJS modules to copy
[DEBUG] : Copying /Users/tlukasavage/Documents/Titanium Studio Workspace/test1/Resources/iphone/appicon.png => /Users/tlukasavage/Documents/Titanium Studio Workspace/test1/build/iphone/build/Debug-iphonesimulator/test1.app/appicon.png
[INFO] : Finished building the application in 8s 579ms
[DEBUG] : Would be firing "postbuild" legacy plugin hook if it was supported
[INFO] : Running application in iOS Simulator
[DEBUG] : Terminating all iOS simulators
[DEBUG] : Removing old log file: /Users/tlukasavage/Library/Application Support/iPhone Simulator/6.0/Applications/6C340125-30CE-4619-90B8-667E85E146DE/Documents/2fab29a2-c337-400f-8863-89582bd7d28a.log
[INFO] : Launching application in iOS Simulator
[DEBUG] : Simulator command: "/Users/tlukasavage/Library/Application Support/Titanium/mobilesdk/osx/3.0.0/iphone/ios-sim" launch "/Users/tlukasavage/Documents/Titanium Studio Workspace/test1/build/iphone/build/Debug-iphonesimulator/test1.app" --sdk 6.0 --family universal
[ERROR] : An error occurred running the iOS Simulator
[DEBUG] : Would be firing "finalize" legacy plugin hook if it was supported
[INFO] : Project built successfully in 9s 632ms
ACT ERR! /Users/tlukasavage/Library/Application Support/Titanium/mobilesdk/osx/3.0.0/iphone/iphone_sim_activate.scpt: execution error: iPhone Simulator got an error: Connection is invalid. (-609)
I cannot reproduce this bug. Can you attach your project that you're struggling with (including build directories)? We might need to do a screenshare.
Master pull request: https://github.com/cb1kenobi/titanium_mobile/pull/new/timob-11495 3.0.x pull request: https://github.com/appcelerator/titanium_mobile/pull/3284
Tested with 3.0.19