{ "id": "83371", "key": "TIMOB-6458", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "10153", "key": "TIMOB", "name": "Titanium SDK/CLI", "projectCategory": { "id": "10100", "description": "Titanium and related SDKs used in application development", "name": "Client" } }, "fixVersions": [], "resolution": { "id": "3", "description": "The problem is a duplicate of an existing issue.", "name": "Duplicate" }, "resolutiondate": "2012-02-10T00:21:43.000+0000", "created": "2011-12-04T18:02:15.000+0000", "priority": { "name": "Critical", "id": "1" }, "labels": [ "dr-list" ], "versions": [ { "id": "12580", "description": "Dual Runtime 1.8.0", "name": "Release 1.8.0.1", "archived": true, "released": true, "releaseDate": "2011-12-22" } ], "issuelinks": [ { "id": "14290", "type": { "id": "10002", "name": "Duplicate", "inward": "is duplicated by", "outward": "duplicates" }, "outwardIssue": { "id": "81130", "key": "TIMOB-5815", "fields": { "summary": "iOS: Native JS Modules not taken in consideration when running the optimalizer for a release build", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "priority": { "name": "Critical", "id": "1" }, "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false } } } }, { "id": "14444", "type": { "id": "10003", "name": "Relates", "inward": "relates to", "outward": "relates to" }, "inwardIssue": { "id": "84248", "key": "TIMOB-7001", "fields": { "summary": "IOS pure js module - build.py fails ", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "priority": { "name": "Critical", "id": "1" }, "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false } } } }, { "id": "14148", "type": { "id": "10003", "name": "Relates", "inward": "relates to", "outward": "relates to" }, "inwardIssue": { "id": "83591", "key": "TIMOB-6573", "fields": { "summary": "iOS: Some modules designed for CommonJS not exporting, even with the \"export\" variable set", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "priority": { "name": "High", "id": "2" }, "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false } } } } ], "assignee": { "name": "stephentramer", "key": "stephentramer", "displayName": "Stephen Tramer", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2012-02-10T00:21:43.000+0000", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [ { "id": "10206", "name": "iOS", "description": "iOS Platform" } ], "description": "It looks like Titanium is having issues resolving symbols in the Ti/Titanium namespace referenced in code that is interpreted at run time. This issue has been observed when creating CommonJS native JavaScript modules for iOS.\r\n\r\nTo replicate the issue create a native JavaScript module for iOS using the steps described in the developer guide:\r\n\r\nhttp://wiki.appcelerator.org/display/guides/iOS+Module+Development+Guide#iOSModuleDevelopmentGuide-BuildingJavaScriptNativeModules\r\n\r\nIn the CommonJS code for the module attempt to open a file using the following code:\r\n\r\nvar file = Ti.Filesystem.getFile(Ti.Filesystem.applicationDataDirectory + \"foo.txt\");\r\n\r\nThis code will execute without issue in the iOS simulator, however on the handset it will cause your application to crash. Putting a reference to the Ti.Filesystem namespace in the app.js file before the module is loaded \"fixes\" the issue on the handset, e.g.:\r\n\r\nTi.API.info(Ti.Filesystem.applicationDataDirectory);\r\nvar o = require('your.module.name');\r\n\r\nIt appears that Titanium needs to resolve these symbols in code loaded in the main interpreter context before they can be used in code that is interpreted at run time.\r\n\r\nSample crash log:\r\n{code}\r\n[INFO] [object ComIrlgamingJsondbModule] loaded\r\n[INFO] exists: file://localhost/var/mobile/Applications/90997746-D7DD-43A3-B0B5-900938FD7683/Documents/test.json\r\n[INFO] exists: file://localhost/var/mobile/Applications/90997746-D7DD-43A3-B0B5-900938FD7683/Documents/test2.json\r\n[ERROR] Script Error = {\r\n expressionBeginOffset = 9119;\r\n expressionCaretOffset = 9127;\r\n expressionEndOffset = 9140;\r\n line = 32;\r\n message = \"Result of expression 'Ti.Utils' [undefined] is not an object.\";\r\n name = TypeError;\r\n sourceId = 65639384;\r\n}.\r\n[DEBUG] application booted in 310.460985 ms\r\n2011-12-04 08:37:20.894 Kiosk[14350:707] -[__NSCFDictionary\r\nsizeWithFont:constrainedToSize:lineBreakMode:]: unrecognized selector\r\nsent to instance 0x1062bd0\r\n[ERROR] The application has crashed with an unhandled exception. Stack trace:\r\n\r\n0 CoreFoundation 0x3539e8bf __exceptionPreprocess + 162\r\n1 libobjc.A.dylib 0x35e191e5 objc_exception_throw + 32\r\n2 CoreFoundation 0x353a1acb -[NSObject\r\ndoesNotRecognizeSelector:] + 174\r\n3 CoreFoundation 0x353a0945 ___forwarding___ + 300\r\n4 CoreFoundation 0x353a17b8 __forwarding_prep_1___ + 56\r\n5 Kiosk 0x000bf3cd -[TiErrorController\r\ndynamicLabel:width:height:fontSize:bottom:] + 164\r\n6 Kiosk 0x000bfae9 -[TiErrorController\r\nloadView] + 1184\r\n7 UIKit 0x376c378b -[UIViewController view] + 50\r\n8 UIKit 0x376cdd53 -[UIViewController\r\nviewControllerForRotation] + 58\r\n9 UIKit 0x376cdcc1 -[UIViewController\r\n_visibleView] + 100\r\n10 UIKit 0x37808d5f\r\n-[UIClientRotationContext\r\ninitWithClient:toOrientation:duration:andWindow:] + 334\r\n11 UIKit 0x3776dd87 -[UIWindow\r\n_setRotatableClient:toOrientation:updateStatusBar:duration:force:isRotating:]\r\n+ 798\r\n12 UIKit 0x3776cdb7\r\n-[UIWindowController\r\ntransition:fromViewController:toViewController:target:didEndSelector:]\r\n+ 1810\r\n13 UIKit 0x3776c14f -[UIViewController\r\npresentViewController:withTransition:completion:] + 3122\r\n14 UIKit 0x377c6d97 -[UIViewController\r\npresentModalViewController:animated:] + 30\r\n15 Kiosk 0x000be199 -[TiApp\r\nshowModalError:] + 240\r\n16 CoreFoundation 0x352fd22b -[NSObject\r\nperformSelector:withObject:] + 42\r\n17 Foundation 0x313e5757\r\n__NSThreadPerformPerform + 350\r\n18 CoreFoundation 0x35372b03\r\n__CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 14\r\n19 CoreFoundation 0x353722cf __CFRunLoopDoSources0 + 214\r\n20 CoreFoundation 0x35371075 __CFRunLoopRun + 652\r\n21 CoreFoundation 0x352f44dd CFRunLoopRunSpecific + 300\r\n22 CoreFoundation 0x352f43a5 CFRunLoopRunInMode + 104\r\n23 GraphicsServices 0x31ddefed GSEventRunModal + 156\r\n24 UIKit 0x376b8743 UIApplicationMain + 1090\r\n25 Kiosk 0x00003d6f main + 66\r\n26 Kiosk 0x00003674 start + 40\r\n\r\n\r\n2011-12-04 08:37:20.948 Kiosk[14350:707] *** Terminating app due to\r\nuncaught exception 'NSInvalidArgumentException', reason:\r\n'-[__NSCFDictionary sizeWithFont:constrainedToSize:lineBreakMode:]:\r\nunrecognized selector sent to instance 0x1062bd0'\r\n*** First throw call stack:\r\n(0x3539e8bf 0x35e191e5 0x353a1acb 0x353a0945 0x353a17b8 0xbf3cd\r\n0xbfae9 0x376c378b 0x376cdd53 0x376cdcc1 0x37808d5f 0x3776dd87\r\n0x3776cdb7 0x3776c14f 0x377c6d97 0xbe199 0x352fd22b 0x313e5757\r\n0x35372b03 0x353722cf 0x35371075 0x352f44dd 0x352f43a5 0x31ddefed\r\n0x376b8743 0x3d6f 0x3674)\r\nterminate called throwing an exception(gdb)\r\n{code}", "attachment": [ { "id": "24779", "filename": "timob6458.tar.gz", "author": { "name": "stephentramer", "key": "stephentramer", "displayName": "Stephen Tramer", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-12-19T17:14:10.000+0000", "size": 1591260, "mimeType": "application/x-gzip" } ], "flagged": false, "summary": "iOS: CommonJS - native JavaScript modules for iOS encounter errors when referencing classes/objects in the Ti namespace", "creator": { "name": "danieleyles", "key": "danieleyles", "displayName": "Dan Eyles", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "danieleyles", "key": "danieleyles", "displayName": "Dan Eyles", "active": true, "timeZone": "America/Los_Angeles" }, "environment": "iOS 4.2+ \r\nTitanium SDK 1.7.5/1.8.0/1.8.0.1", "comment": { "comments": [ { "id": "174966", "author": { "name": "stephentramer", "key": "stephentramer", "displayName": "Stephen Tramer", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Looks like this is the exact same issue as TIMOB-6457. Suggesting they be resolved together.", "updateAuthor": { "name": "stephentramer", "key": "stephentramer", "displayName": "Stephen Tramer", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-12-05T18:21:35.000+0000", "updated": "2011-12-05T18:21:35.000+0000" }, { "id": "174968", "author": { "name": "mapperson", "key": "mapperson", "displayName": "Matthew Apperson", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Stephen, \r\n\r\nAre you sure? This has to do with compiled modules, and the other with normal CommonJS...", "updateAuthor": { "name": "mapperson", "key": "mapperson", "displayName": "Matthew Apperson", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-12-05T18:35:30.000+0000", "updated": "2011-12-05T18:35:30.000+0000" }, { "id": "176533", "author": { "name": "stephentramer", "key": "stephentramer", "displayName": "Stephen Tramer", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Looks like this is a dupe and should be tested at the same time as TIMOB-5815.", "updateAuthor": { "name": "stephentramer", "key": "stephentramer", "displayName": "Stephen Tramer", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-12-19T12:11:00.000+0000", "updated": "2011-12-19T12:11:00.000+0000" }, { "id": "176627", "author": { "name": "stephentramer", "key": "stephentramer", "displayName": "Stephen Tramer", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Attached complete test for this bug.", "updateAuthor": { "name": "stephentramer", "key": "stephentramer", "displayName": "Stephen Tramer", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-12-19T17:14:10.000+0000", "updated": "2011-12-19T17:14:10.000+0000" }, { "id": "178121", "author": { "name": "bitshftr", "key": "bitshftr", "displayName": "Shawn Lipscomb", "active": true, "timeZone": "America/New_York" }, "body": "I am getting failure to resolve Ti.Network inside a commonJS module, and the workaround of referencing Ti.Network in app.js is NOT solving this one.", "updateAuthor": { "name": "bitshftr", "key": "bitshftr", "displayName": "Shawn Lipscomb", "active": true, "timeZone": "America/New_York" }, "created": "2012-01-05T08:50:15.000+0000", "updated": "2012-01-05T08:50:15.000+0000" }, { "id": "178237", "author": { "name": "bitshftr", "key": "bitshftr", "displayName": "Shawn Lipscomb", "active": true, "timeZone": "America/New_York" }, "body": "^^^ I've been looking into this Ti.Network issue, and it's a little more complicated. There are several levels of require() being used. I'm trying to cut a test project down to a minimum...will post it here soon.", "updateAuthor": { "name": "bitshftr", "key": "bitshftr", "displayName": "Shawn Lipscomb", "active": true, "timeZone": "America/New_York" }, "created": "2012-01-05T15:57:07.000+0000", "updated": "2012-01-05T15:57:07.000+0000" }, { "id": "178240", "author": { "name": "stephentramer", "key": "stephentramer", "displayName": "Stephen Tramer", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Ti.Network has some additional symbols associated with it. In particular you may need to explicitly create sockets or HTTPClient objects in addition to just declaring that you use Ti.Network, due to how conditional compilation on iOS behaves.\r\n\r\nThere is a fix for this issue pending, but it does require module redistribution.", "updateAuthor": { "name": "stephentramer", "key": "stephentramer", "displayName": "Stephen Tramer", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-01-05T16:00:48.000+0000", "updated": "2012-01-05T16:00:48.000+0000" }, { "id": "178244", "author": { "name": "bitshftr", "key": "bitshftr", "displayName": "Shawn Lipscomb", "active": true, "timeZone": "America/New_York" }, "body": "My app does use Ti.Network.createHTTPClient(), although it is done in a commonJS unit (which is required() by another commonJS unit that is required() in app.js).\r\n\r\nWhat is \"module redistribution\"?\r\n\r\nAnd can you post a comment to this JIRA ticket when the continuous build that includes this fix is ready, so I can try it out?", "updateAuthor": { "name": "bitshftr", "key": "bitshftr", "displayName": "Shawn Lipscomb", "active": true, "timeZone": "America/New_York" }, "created": "2012-01-05T16:08:19.000+0000", "updated": "2012-01-05T16:08:19.000+0000" }, { "id": "178248", "author": { "name": "stephentramer", "key": "stephentramer", "displayName": "Stephen Tramer", "active": true, "timeZone": "America/Los_Angeles" }, "body": "This ticket will be marked RESOLVED/FIXED when the fix is available in CI off master.\r\n\r\nIf you're referring to compiled CommonJS modules, those modules are what need to be redistributed. If you're using a raw .js file, please provide some details about where the file is located (it should be in the Resources directory, which means it will be picked up for compile-time checking).", "updateAuthor": { "name": "stephentramer", "key": "stephentramer", "displayName": "Stephen Tramer", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-01-05T16:13:25.000+0000", "updated": "2012-01-05T16:13:25.000+0000" }, { "id": "178362", "author": { "name": "bitshftr", "key": "bitshftr", "displayName": "Shawn Lipscomb", "active": true, "timeZone": "America/New_York" }, "updateAuthor": { "name": "bitshftr", "key": "bitshftr", "displayName": "Shawn Lipscomb", "active": true, "timeZone": "America/New_York" }, "created": "2012-01-06T10:44:18.000+0000", "updated": "2012-01-06T10:44:18.000+0000" }, { "id": "178375", "author": { "name": "stephentramer", "key": "stephentramer", "displayName": "Stephen Tramer", "active": true, "timeZone": "America/Los_Angeles" }, "body": "If this is a bug which is occurring with pure JS modules included via require() that are located in the {{Resources}}, then it likely is something different. I'll inform community that they should bring the bug into our database.", "updateAuthor": { "name": "stephentramer", "key": "stephentramer", "displayName": "Stephen Tramer", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-01-06T11:26:15.000+0000", "updated": "2012-01-06T11:26:15.000+0000" }, { "id": "178383", "author": { "name": "bitshftr", "key": "bitshftr", "displayName": "Shawn Lipscomb", "active": true, "timeZone": "America/New_York" }, "body": "It *is* with pure JS modules included via require() that are located in Resources.", "updateAuthor": { "name": "bitshftr", "key": "bitshftr", "displayName": "Shawn Lipscomb", "active": true, "timeZone": "America/New_York" }, "created": "2012-01-06T12:11:18.000+0000", "updated": "2012-01-06T12:11:18.000+0000" }, { "id": "179269", "author": { "name": "nhuynh", "key": "nhuynh", "displayName": "Natalie Huynh", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Closing as a dupe of TIMOB-5815", "updateAuthor": { "name": "nhuynh", "key": "nhuynh", "displayName": "Natalie Huynh", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-01-13T15:28:14.000+0000", "updated": "2012-01-13T15:28:14.000+0000" } ], "maxResults": 15, "total": 15, "startAt": 0 } } }