Discussion Forums  >  Config Data, JSON, App Refresh

Replies: 5    Views: 117

Derval
Aspiring developer
Profile
Posts: 364
Reg: Sep 20, 2012
Milan
17,240
10/18/12 01:37 PM (13 years ago)

Error message when hit app refresh

My app runs fine until I hit the refresh button. I am using Xcode 4.5 and iOS 6. When I hit refresh, I get the following error message: There was a problem saving some data to the devices cache. The log read out is below. I have copied the config file into Xcode again but the problem did not go away. Any thoughts? I thought it was because I was using a foreign language in my app with different characters so I took them all out, but this didn’t work either. Thanks for any help you can provide. I have spent hours on it trying to resolve it. 2012-10-18 22:25:08.806 paddysday[2324:1af03] BT_fileManager: saveTextFileToCacheWithEncoding: ERROR saving string data to file: cachedAppConfig.txt encodingFlag: 4 error:The operation couldn’t be completed. (Cocoa error 4.) 2012-10-18 22:25:08.806 paddysday[2324:1af03] BT_downloader: Error returning string (tried UTF-8 Encoding): cachedAppConfig.txt 2012-10-18 22:25:08.806 paddysday[2324:1af03] paddysday_appDelegate: downloadFileCompleted 2012-10-18 22:25:08.806 paddysday[2324:1af03] paddysday_appDelegate: hideProgress 2012-10-18 22:25:08.807 paddysday[2324:1af03] BT_fileManager: saveTextFileToCacheWithEncoding: cachedAppConfig.txt encodingFlag: -1 2012-10-18 22:25:08.808 paddysday[2324:1af03] BT_fileManager: saveTextFileToCacheWithEncoding: ERROR saving string data to file: cachedAppConfig.txt encodingFlag: 4 error:The operation couldn’t be completed. (Cocoa error 4.) 2012-10-18 22:25:08.808 paddysday[2324:1af03] paddysday_appDelegate: error saving downloaded app config data 2012-10-18 22:25:08.809 paddysday[2324:1af03] paddysday_appDelegate: hideProgress 2012-10-18 22:25:11.727 paddysday[2324:1af03] paddysday_appDelegate: alertView clickedButtonAtIndex: 0
 
LeonG
Apple Fan
Profile
Posts: 694
Reg: Nov 08, 2011
Hamburg
17,740
like
10/18/12 03:17 PM (13 years ago)
1.5, 2.0 or self hosted? What sort of screen do you have on the refresh page?
 
David @ buzztouch
buzztouch Evangelist
Profile
Posts: 6866
Reg: Jan 01, 2010
Monterey, CA
78,840
like
10/18/12 06:20 PM (13 years ago)
@Dervalo: I think you're on the right track. This is a technical reply so I hope I dont' lose ya! The message in the console output suggests that iOS is having trouble saving the data (config data from your control panel) using the default encoding - UTF8. In most cases, this encoding is fine. But, like you're thinking, there are cases where international characters and symbols do confuse iOS when it's not expecting to encounter them. The UTF8 encoding setting in your source code instructs iOS to expect only characters included in the UTF8 character set. If it encounters something else, it's confused and can't save the data to the device. So... Have a look at two different files in your Xcode project. BT_Config/[your app name]_appDelegate.m BT_Core/BT_fileManager.m In your delegate file, scroll down to line 639 and find this: if([BT_fileManager saveTextFileToCacheWithEncoding:message:[self saveAsFileName]:-1]){ That says "Hey BT_fileManage, save this data and use encoding -1" In this case, when -1 is used, it's the default UTF8 character set. You could try a different setting to see if this is an international issue. Have a look at the BT_fileManager.m file. Look near the top of it starting on line 43. You'll see a bunch of character sets with numbers. Test these like... if([BT_fileManager saveTextFileToCacheWithEncoding:message:[self saveAsFileName]:5]){ Notice how I replaced the -1 with a 5. This means... "hey BT_fileManager, save this data with encoding NSISOLatin1StringEncoding. You can test some of these character sets to see if it makes a different. I'll be it does :-)
 
LeonG
Apple Fan
Profile
Posts: 694
Reg: Nov 08, 2011
Hamburg
17,740
like
10/19/12 12:42 AM (13 years ago)
That would have been the next thing I wanted to say ;-)
 
Derval
Aspiring developer
Profile
Posts: 364
Reg: Sep 20, 2012
Milan
17,240
like
10/22/12 03:31 AM (13 years ago)
David, thanks for your quick reply - I appreciate it. I would have responded quicker if it had not been for a four-year-old’s birthday party, which got in the way! Anyway, I tinkered around with the encoding references in the BT_fileManager file by replacing the -1 with 5 in the BT_Config file as you suggested. In fact, I tried all 23 of them, but to no avail. The error message kept coming back when I hit the refresh button. It turns out I was barking up the wrong tree and of course, if you had seen what I was trying to do, you would have picked up on it immediately. I was using the HTML plugin without actually attaching a HTML document. I wasn’t too concerned about leaving the document out because I had a background image, audio and a nav. bar title which were all working fine, so I thought it was ok to skip adding an actual .html document. I thought if that had been the problem, the error message would show something like “.html file not found”, but since it said “error returning string”, I thought it was something to do with the foreign language characters used in the nav. bar title. Anyway, I have now added .html documents and I no longer get any error messages - surprise surprise, I hear you say! Thanks again for your help…. learning loads everyday trying to figure all this stuff out! Hope to make a couple of the Webinars this week too. Next time you’re in Europe, come sailing with us in the Med!!! @LeonG - loving the sense of humour - sorely needed in times like these!!! (p.s. v. 2.0, not self-hosted)
 
LeonG
Apple Fan
Profile
Posts: 694
Reg: Nov 08, 2011
Hamburg
17,740
like
10/22/12 03:55 AM (13 years ago)
perfect :-) "closed"
 

Login + Screen Name Required to Post

pointerLogin to participate so you can start earning points. Once you're logged in (and have a screen name entered in your profile), you can subscribe to topics, follow users, and start learning how to make apps like the pros.