Issue launching from Xcode: could not find app.js

620 views
Skip to first unread message

Chris

unread,
Jan 16, 2013, 10:35:11 AM1/16/13
to titanium...@googlegroups.com
My app launches fine with cake t:iphone:run, but if I load the project (from the build folder) in xcode and try to launch in the simulator or on the device, I get the error below.  Has anyone seen a similar error?

[ERROR] Error loading path: file://localhost/Users/[username]/Library/Application%20Support/iPhone%20Simulator/6.0/Applications/71814CFC-4A84-4B21-9602-62ACF66484CD/chris.app/app.js, Error Domain=NSCocoaErrorDomain Code=260 "The operation couldn’t be completed. (Cocoa error 260.)" UserInfo=0xa6a7f30 {NSFilePath=/Users/[username]/Library/Application Support/iPhone Simulator/6.0/Applications/71814CFC-4A84-4B21-9602-62ACF66484CD/chris.app/app.js, NSUnderlyingError=0xa6a7e90 "The operation couldn’t be completed. No such file or directory"}

[ERROR] Script Error = Could not find the file app.js.


Matt Dean

unread,
Jan 16, 2013, 10:57:00 AM1/16/13
to titanium...@googlegroups.com
Chris,

I just launched a newly-created app from XCode on the simulator and it worked fine. Can you post your app to github and send a link (without the 'build' directory)? Also, which XCode version are you using?

Matt

Chris

unread,
Jan 17, 2013, 9:32:34 PM1/17/13
to titanium...@googlegroups.com
Finally figured it out; it's a bug in Titanium SDK 3.0.0.GA.  Detail and solution here: http://developer.appcelerator.com/question/146871/error-could-not-find-appjs

titanium sdk install --branch 3_0_X

This updates to the latest build which caused a separate dependency issue.  I used the fix outlined here: http://developer.appcelerator.com/question/85671/invalid-method-createtoolbar-passed-to-uimodule-on-device by adding this line to app.coffee, just below the first require:

(() -> 
  used = [ Ti.UI.createActivityIndicator, Ti.UI.createWindow, Ti.UI.createButton, Ti.UI.createLabel ]
)()

which specifies what Titanium dependencies my app has.

Hope that helps someone else!
Chris

Matt Dean

unread,
Jan 18, 2013, 9:19:06 AM1/18/13
to titanium...@googlegroups.com
Chris, thanks for tracking that down! I wasn't familiar with the app.js issue but I have come across the issue with missing modules. I usually end up with something like this at the top of my app.js:

// Add these so Appcelerator doesn't strip out these modules
Ti.Media.showCamera; Ti.UI.createActivityIndicator; Ti.UI.createAlertDialog; Ti.UI.createButton; Ti.UI.createButtonBar; Ti.UI.createImageView; Ti.UI.createLabel; Ti.UI.createOptionDialog; Ti.UI.createPicker; Ti.UI.createScrollableView; Ti.UI.createScrollView; Ti.UI.createSearchBar; Ti.UI.createSplitView; Ti.UI.createSwitch; Ti.UI.createTab; Ti.UI.createTabGroup; Ti.UI.createTabbedBar; Ti.UI.createTableView; Ti.UI.createTableViewRow; Ti.UI.createTableViewSection; Ti.UI.createTextArea; Ti.UI.createTextField; Ti.UI.createToolbar; Ti.UI.createView; Ti.UI.createWebView; Ti.UI.createWindow;
Ti.UI.iPhone.createNavigationGroup; Ti.Map.createView; Ti.Map.createAnnotation; Ti.UI.createPicker; Ti.UI.iOS.createToolbar; Ti.UI.iOS.createTabbedBar;

I'm a bit concerned about overloading the generated app.js with every module that might possibly be used within the app as it prevents Titanium from removing unused modules, but of course I also don't want everyone to rediscover the problem you did.

Perhaps it would be best to list out all of them in app.js with a comment indicating that unused modules can be removed from the list to reduce the application size before deployment. Think that would help?

Matt


Chris

unread,
Jan 19, 2013, 7:55:57 PM1/19/13
to titanium...@googlegroups.com
A comment would help, yeah.  I also thought it might be possible to add a build step that automatically went through the coffee files and added the modules that are actually used just before compiling to js.  I looked into it but haven't spent too much time on it yet.
Reply all
Reply to author
Forward
0 new messages