{ "id": "100478", "key": "AC-1886", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "12217", "key": "AC", "name": "Appcelerator - INBOX", "projectCategory": { "id": "10000", "description": "", "name": "Customer Service" } }, "resolution": { "id": "8", "description": "", "name": "Needs more info" }, "resolutiondate": "2012-09-26T21:47:16.000+0000", "created": "2012-09-05T07:21:29.000+0000", "labels": [], "versions": [], "issuelinks": [], "assignee": { "name": "shossain", "key": "shossain", "displayName": "Shak Hossain", "active": false, "timeZone": "America/Los_Angeles" }, "updated": "2016-03-08T07:40:48.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": "14548", "name": "Titanium SDK & CLI", "description": "Please enter tickets related to the MobileSDK here." } ], "description": "The compiler seems to miss that Ti.Media is used when it's inside a function in an object:\r\n\r\n{code}\r\nvar Rf = {media:{}};\r\n\r\n// uncomment this to fix the compiler issue: \r\n// var test = Ti.Media.fireEvent('hi');\r\n\r\nRf.media.photo = {\r\n \r\nkey: 'photo',\r\n title: 'Photo',\r\n extension: 'jpg',\r\n type: 'image/jpeg',\r\n create: function(created) {\r\n \r\nTi.Media.showCamera({\r\n animated: false,\r\n saveToPhotoGallery: false,\r\n showControls: true,\r\n success: function() { \r\n \r\nvar name = Rf.util.timestamp() + '.' + Rf.media.photo.extension;\r\nRf.write_to_new_file(name, media_item.media, function(file) {\r\ncreated(file);\r\n \r\n \r\n \r\n });\r\n },\r\n error:function(error)\r\n {\r\n // create alert\r\n var a = Titanium.UI.createAlertDialog({title:'Camera'});\r\n \r\n // set message\r\n if (error.code == Titanium.Media.NO_CAMERA)\r\n {\r\n a.setMessage('Please run this test on device');\r\n }\r\n else\r\n {\r\n a.setMessage('Unexpected error: ' + error.code);\r\n }\r\n \r\n // show alert\r\n a.show();\r\n },\r\n cancel:function()\r\n {\r\n \r\n },\r\n});\r\n \r\n \r\n }\r\n};\r\n\r\nRf.media.photo.create(function(f){\r\n\tvar test = f;\r\n});\r\n{code}\r\n\r\nIf you run this code, you get the \"'undefined' is not an object (evaluating 'Ti.Media.showCamera')\" error. If you un-comment the fireEvent line, everything works fine.", "attachment": [], "flagged": false, "summary": "Ti.Media not detected by compiler", "creator": { "name": "iotashan", "key": "iotashan", "displayName": "Shannon Hicks", "active": true, "timeZone": "America/Chicago" }, "subtasks": [], "reporter": { "name": "iotashan", "key": "iotashan", "displayName": "Shannon Hicks", "active": true, "timeZone": "America/Chicago" }, "environment": "iOS / Ti 2.1.2GA", "comment": { "comments": [ { "id": "218650", "author": { "name": "egomez", "key": "egomez", "displayName": "Eduardo Gomez", "active": false, "timeZone": "America/Los_Angeles" }, "body": "@Shannon Hicks What is your iOS version?\r\n\r\nJust grabbed & installed your sample code directly on iPhone 4 with iOS 5.1 - got the camera working.\r\n\r\nI will leave this open for a while for further clarifications.\r\n\r\nh6.Sample code\r\n{code}\r\nvar Rf = {media:{}};\r\n \r\n// uncomment this to fix the compiler issue: \r\n// var test = Ti.Media.fireEvent('hi');\r\n \r\nRf.media.photo = {\r\n\r\n\tkey : 'photo',\r\n\ttitle : 'Photo',\r\n\textension : 'jpg',\r\n\ttype : 'image/jpeg',\r\n\tcreate : function(created) {\r\n\t\t\r\n\t\tTi.Media.showCamera({\r\n\t\t\tanimated : false,\r\n\t\t\tsaveToPhotoGallery : false,\r\n\t\t\tshowControls : true,\r\n\t\t\tsuccess : function() {\r\n\r\n\t\t\t\tvar name = Rf.util.timestamp() + '.' + Rf.media.photo.extension;\r\n\t\t\t\tRf.write_to_new_file(name, media_item.media, function(file) {\r\n\t\t\t\t\tcreated(file);\r\n\r\n\t\t\t\t});\r\n\t\t\t},\r\n\t\t\terror : function(error) {\r\n\t\t\t\t// create alert\r\n\t\t\t\tvar a = Titanium.UI.createAlertDialog({\r\n\t\t\t\t\ttitle : 'Camera'\r\n\t\t\t\t});\r\n\r\n\t\t\t\t// set message\r\n\t\t\t\tif (error.code == Titanium.Media.NO_CAMERA) {\r\n\t\t\t\t\ta.setMessage('Please run this test on device');\r\n\t\t\t\t} else {\r\n\t\t\t\t\ta.setMessage('Unexpected error: ' + error.code);\r\n\t\t\t\t}\r\n\r\n\t\t\t\t// show alert\r\n\t\t\t\ta.show();\r\n\t\t\t},\r\n\t\t\tcancel : function() {\r\n\r\n\t\t\t},\r\n\t\t});\r\n\r\n\t}\r\n};\r\n\r\nRf.media.photo.create(function(f) {\r\n\tvar test = f;\r\n}); \r\n{code} ", "updateAuthor": { "name": "egomez", "key": "egomez", "displayName": "Eduardo Gomez", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2012-09-12T10:08:53.000+0000", "updated": "2012-09-12T10:08:53.000+0000" }, { "id": "221109", "author": { "name": "egomez", "key": "egomez", "displayName": "Eduardo Gomez", "active": false, "timeZone": "America/Los_Angeles" }, "body": "It's been 2 weeks now, closing due to age in no response.", "updateAuthor": { "name": "egomez", "key": "egomez", "displayName": "Eduardo Gomez", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2012-09-26T21:47:16.000+0000", "updated": "2012-09-26T21:47:16.000+0000" }, { "id": "288671", "author": { "name": "shossain", "key": "shossain", "displayName": "Shak Hossain", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Closing since the issue is not reproducible with 3.2+ of TISDK.", "updateAuthor": { "name": "shossain", "key": "shossain", "displayName": "Shak Hossain", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2014-01-17T21:59:12.000+0000", "updated": "2014-01-17T21:59:12.000+0000" } ], "maxResults": 5, "total": 5, "startAt": 0 } } }