{ "id": "109678", "key": "AC-1729", "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": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2013-02-14T18:52:52.000+0000", "created": "2013-02-13T20:21:36.000+0000", "labels": [ "android", "defect", "studio3" ], "versions": [], "issuelinks": [], "assignee": { "name": "clathrop", "key": "clathrop", "displayName": "Carter Lathrop", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2016-03-08T07:40:36.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": "14551", "name": "Studio", "description": "Please enter tickets related to Titanium Studio here." }, { "id": "14548", "name": "Titanium SDK & CLI", "description": "Please enter tickets related to the MobileSDK here." } ], "description": "Worst possible scenario - an intermittent fault!\r\n\r\nIt mostly fails but occasionally will work!\r\n\r\nI am downloading Facebook Profile Pictures and trying to save them to the ApplicationDataDirectory (but any internal directory would be fine!)\r\n\r\nThe file is received and then the app does a hard reset and restarts. No 'rsod' or java exceptions, it just restarts!\r\n\r\nEventually after enough restarts it will have actually successfully saved all of the required profile pictures.\r\n\r\nNO, the number of restarts does NOT correlate to the number of pictures required - the number of restarts is much higher and variable / random.\r\n\r\nOnce it has managed to save all the profile pictures, they all load perfectly without issue.\r\n\r\nThe restart occurs when trying to actually write the file to the filesystem. I have tested the code by commenting out various sections and lines to see what causes the crash and it is the 'file.write()' command that does it!\r\n\r\nI know I could just download the pictures on the fly as a workaround but that's 1) slow, 2) uses up users' monthly data allowance and 3) is plastering over a crack!\r\n\r\nThe problem occurs on 2 completely different, unrelated Android devices from different manufacturers with different Android versions.\r\n\r\nYes, the function IS being sent correct Facebook account data, held in friendsArray[friendCount].id\r\n\r\nMany thanks in advance,\r\n\r\nRobin\r\n\r\n{code:xml}\r\ngetAllProfilePictures = function(friendCount){\r\n\r\n\tvar playerToGet = friendsArray[friendCount].id;\r\n\t\t\r\n\tvar pictureFile = Ti.Filesystem.getFile(Ti.Filesystem.applicationDataDirectory, playerToGet +'.jpg');\r\n\tif (!pictureFile.exists()){\r\n\t\r\n\t\tvar xhr = Ti.Network.createHTTPClient();\r\n\t\t\r\n\t\txhr.onload = function(){\r\n\r\n\t\t\tholder = this.responseData;\r\n\t\t\tpictureFile.write(holder);\r\n\t\t\tpictureFile = null;\r\n\t\t\tif(friendCount > 0 ) {\r\n\t\t\t\tfriendCount-=1;\r\n\t\t\t\tgetAllProfilePictures(friendCount);\r\n\t\t\t} else {\r\n\t\t\t\treturn;\r\n\t\t\t};\r\n\t\t};\r\n\r\n\t\txhr.open('GET', 'https://graph.facebook.com/' + playerToGet + '/picture');\r\n\t\txhr.send();\t\r\n\t\r\n\t} else if(friendCount > 0 ) {\r\n\t\t\t\tpictureFile = null;\r\n\t\t\t\tfriendCount-=1;\r\n\t\t\t\tgetAllProfilePictures(friendCount);\r\n\t\t\t} else {\r\n\r\n\t\t\t\treturn;\r\n\t\t\t};\r\n\r\n}; // End Get All Profile Pictures Function\r\n\r\n{code}", "attachment": [], "flagged": false, "summary": "Application hard-resets when saving an image file to internal storage", "creator": { "name": "evil_dr_fish", "key": "evil_dr_fish", "displayName": "Robin Williams", "active": true, "timeZone": "Europe/London" }, "subtasks": [], "reporter": { "name": "evil_dr_fish", "key": "evil_dr_fish", "displayName": "Robin Williams", "active": true, "timeZone": "Europe/London" }, "environment": "Running on Sony Xperia Arc S LT18i (Android 2.3.4) AND ASUS Transformer TF300T (Android 4.0)\r\n\r\nTitanium Studio, build: 3.0.1.201212181159\r\n(c) Copyright 2012 by Appcelerator, Inc. All rights reserved.\r\n\r\nBuild: jenkins-titanium-rcp-master-350 (origin/master)\r\nDate: 18 December 2012, 12:04:42\r\n\r\nWindows 7", "comment": { "comments": [ { "id": "238414", "author": { "name": "clathrop", "key": "clathrop", "displayName": "Carter Lathrop", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Robin,\n\nWould you mind editing your code so it can be directly pasted into an app.js and run right away? This way I can more quickly determine the validity of the bug and pass it on to engineering. \n\nThank you,\n\nCarter", "updateAuthor": { "name": "clathrop", "key": "clathrop", "displayName": "Carter Lathrop", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-02-13T21:32:40.000+0000", "updated": "2013-02-13T21:32:40.000+0000" }, { "id": "238535", "author": { "name": "evil_dr_fish", "key": "evil_dr_fish", "displayName": "Robin Williams", "active": true, "timeZone": "Europe/London" }, "body": "Hi Carter,\n\nThanks for your help.\n\nIs there an e-mail address I can send you the file to please?\n\nI'd really rather not post anything in public as I'm not sure if it would expose any I.P at this point?!\n\nMany thanks,\n\nRobin", "updateAuthor": { "name": "evil_dr_fish", "key": "evil_dr_fish", "displayName": "Robin Williams", "active": true, "timeZone": "Europe/London" }, "created": "2013-02-14T14:08:29.000+0000", "updated": "2013-02-14T14:08:29.000+0000" }, { "id": "238576", "author": { "name": "clathrop", "key": "clathrop", "displayName": "Carter Lathrop", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Robin,\n\nIs there no way to minimize your code as to isolate the bug in question? This will have to be done in order for engineering to look at the problem and come to a solution. This is why I ask. Try to break down your code into the smallest possible size while still displaying the bug and I will take a look at it. PM me at clathrop@appcelerator.com with the project.\n\nRegards,\n\nCarter", "updateAuthor": { "name": "clathrop", "key": "clathrop", "displayName": "Carter Lathrop", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-02-14T18:18:13.000+0000", "updated": "2013-02-14T18:18:13.000+0000" }, { "id": "238582", "author": { "name": "evil_dr_fish", "key": "evil_dr_fish", "displayName": "Robin Williams", "active": true, "timeZone": "Europe/London" }, "body": "\nHi Carter,\n\nThank you for your response.\n\nIn order to e-mail you some functional code, this afternoon I had condensed the code down to about 500 lines using a very, very early prototype / testbed program I had made when first trying out some of the functions for my game.\n\nThe most extraordinary thing happened...\n\nWhen I first ran the 'testbed' version with the troublesome code pasted into it, the program did indeed reset as per usual, so I thought \"okay... here we go again...\"\n\nI tidied up a couple of bits and bobs in the code to send to you (just removing unneeded functions and buttons etc) and recompiled and ran the code and it didn't reset! I uninstalled and reinstalled numerous times and it didn't reset again.\n\nSo... I uninstalled the actual game itself and reinstalled it using the exact same apk I had previously installed it with and it reset once. I uninstalled and reinstalled (many many times) and it hasn't reset once!\n\nI did this both on my telephone and my tablet and the exact same thing happened on both devices!\n\nSo something which has been causing the program to hard reset every time for the last few weeks has stopped doing it after I installed a different app that accessed the internal storage.\n\nIt is utterly inexplicable!\n\nI am really glad it is all now working as I couldn't for the life of me see anything that was incorrect in my code (after weeks of trying!) but I cannot explain what caused it to stop or then caused it to start working again?!\n\nMany thanks for your time,\n\nRobin\n", "updateAuthor": { "name": "evil_dr_fish", "key": "evil_dr_fish", "displayName": "Robin Williams", "active": true, "timeZone": "Europe/London" }, "created": "2013-02-14T18:41:49.000+0000", "updated": "2013-02-14T18:41:49.000+0000" }, { "id": "238595", "author": { "name": "evil_dr_fish", "key": "evil_dr_fish", "displayName": "Robin Williams", "active": true, "timeZone": "Europe/London" }, "body": "I should point out that I haven't actually changed *anything* in the code! I ran a different program, using a copy and paste of the code and it has started working again! :-s\n\nMany Thanks!\n\nRobin", "updateAuthor": { "name": "evil_dr_fish", "key": "evil_dr_fish", "displayName": "Robin Williams", "active": true, "timeZone": "Europe/London" }, "created": "2013-02-14T19:35:09.000+0000", "updated": "2013-02-14T19:35:09.000+0000" } ], "maxResults": 6, "total": 6, "startAt": 0 } } }