I am having some trouble on my device for an app that was approved by Apple for sale on the store. I thought it was strange that it was approved, but since I know little about their approval process, maybe its not.
Anyway, here is the code I am using to download a remote .zip file and unzip it to the device:
var xhr = Titanium.Network.createHTTPClient();
xhr.onload = function()
{
var path = Titanium.Filesystem.applicationDataDirectory;
if (Titanium.Filesystem.getFile(path,'1-1.jpg').exists())
{
introScreen.remove(viewLoad);
ntroScreen.remove(actInd);
introScreen.add(view);
introScreen.add(ci);
} else {
var f = Ti.Filesystem.getFile(Ti.Filesystem.applicationDataDirectory, 'HFTImages.zip');
f.write(this.responseData);
Ti.API.log('INFO',Ti.Filesystem.applicationDataDirectory);
var appDir =
Ti.Network.decodeURIComponent(Ti.Filesystem.applicationDataDirectory).replace('file://localhost','') ;
zipfile.extract(appDir+'HFTImages.zip', appDir);
f.deleteFile();
introScreen.remove(viewLoad);
introScreen.remove(actInd);
introScreen.add(view);
introScreen.add(ci);
Ti.API.info('The file has been extracted to:'+appDir);
}
};
xhr.open('GET','http://dl.dropbox.com/u/23138095/HFTImages.zip');
xhr.send();
If it helps anyone, here is the crash log I got:
Incident Identifier: A2053187-D47E-459A-AA5E-B631D5B55282
CrashReporter Key: ca558f421734b4d844e54d004ede3913830139f8
OS Version: iPhone OS 3.1.3 (7E18)
Date: 2012-03-01 19:29:13 -0500
Free pages: 96
Wired pages: 10558
Purgeable pages: 0
Largest process: Hooray For Today
Processes
Name UUID Count resident pages
Hooray For Today <cc527ca9b51937c5adbe035fe27a7b12> 9320 (jettisoned) (active)
mediaserverd <3d3800d6acfff050e4d0ed91cbe2467e> 255
dataaccessd <13d80b2e707acc91f9aa3ec4c715b9cc> 505
syslogd <8eddddc00294d5615afded36ee3f1b62> 71
apsd <32070d91b216d806973c8f1b1d8077a4> 171
securityd <b9e51062610d27f727c5119b8f80dcdf> 243
notifyd <591dd4dd804b4b8741f52335ea1fa4ab> 2027
CommCenter <b4b87526ae086bb62c982f1078f43f81> 189
SpringBoard <324939a437d1cca1fa4af72d9f5d0eba> 2158 (active)
accessoryd <8f21c8b376d16e2ccb95ed6d21d8317a> 91
configd <85efd41aceac34ccc0019df76623c7a9> 371
fairplayd <a2eaf736b3e07c7c9a2c82e9eb893555> 93
mDNSResponder <df1cd275e4ad434e0575990e8e1da4cb> 292
lockdownd <80d2bd44c0bcca273d48ce52010f7e65> 1204
launchd <a5988245aade809bf77576f1d9de42c5> 72
**End**
Can anyone see where I might have a memory spike or something else going on? It works great in the emulator.
Please help if anyone can. I cannot thank you all enough for your time!
Your device is running out of memory and hence killed by iOS. I have no experience with Titanium, so can’t give any real solution. You might want to test it with a very small zip file to check if that works.
It also depends if
zipfile.extractis requiring a lot of memory for the extraction process. Hope this helps at least a little.Edit: the reason could also be that the app was unresponsive for too long, hinting that the unzipping process blocked the main thread for too long so the watchdog killed it.