Hmmm
buzztouch Evangelist
Profile
Posts: 67
Reg: Sep 17, 2013
location unknow...
6,670
12/01/14 05:57 PM (9 years ago)

File save error - reportToCloud during app launch

Our new app is crashing on launch during Apple review with the following reported error: "There was a problem saving some required data. Try again? Select "yes" the pop-up returns, selecting "No" the app quits." Our testing on an iPhone 5s 8.1.1 will not replicate this bug on the device, or simulator. The error is being reported in the downloadFileCompleted function, in BT_Layout / BT_loadConfigDataViewController.m The app has been modified to reportToCloud from within BT_Layout / BT_loadConfigDataViewController / loadAppData, which updates the modified file with the current config date/time. Is it possible under certain conditions (low network latency) for the the data requested by loadAppData and the data requested by reportToCloud to be saved simultaneously? It this a plausible hypothesis? If so, any suggestions for a work around? If not, any thoughts about what may be causing this during review, which we cannot replicate, would be greatly appreciated. Thanks.
 
Hmmm
buzztouch Evangelist
Profile
Posts: 67
Reg: Sep 17, 2013
location unknow...
6,670
like
12/02/14 09:54 AM (9 years ago)
SOLUTION: Below is code we integrated to prevent triggering a second refreshAppData when the app first loads. We tested our above hypothesis and determined it to be the most logical variable for this case. The below code modification creates an initial last modified file with the current date/time, which prevents the reportToCloud from requesting data. If this bug reoccurs, we will re-visit this thread with another hack at the solution. If you run into anything similar, please share, or feel free to contact us and we'll do what we can to help out. Thanks. //xxx_appDelegate.m approximately line 285 //reportToCloud... -(void)reportToCloud{ [BT_debugger showIt:self message:[NSString stringWithFormat:@"reportToCloud%@", @""]]; //if we do not have any reportToCloud results yet, make a fake one... if(![BT_fileManager doesLocalFileExist:[self modifiedFileName]]){ //Replaced with valid json directly below this commented out code //[BT_fileManager saveTextFileToCacheWithEncoding:@"blankLastModified" fileName:self.modifiedFileName encodingFlag:-1]; //Create a modified file with the current date/time... NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init]; dateFormatter.dateFormat = @"yyyy-MM-dd' 'HH:mm:ss"; NSTimeZone *gmt = [NSTimeZone timeZoneWithAbbreviation:@"GMT"]; [dateFormatter setTimeZone:gmt]; NSString *utcTimeStamp = [dateFormatter stringFromDate:[NSDate date]]; NSString *modifiedJson = [NSString stringWithFormat:@"{\"lastModifiedUTC\":\"%@\"}", utcTimeStamp]; [BT_fileManager saveTextFileToCacheWithEncoding:modifiedJson fileName:self.modifiedFileName encodingFlag:-1]; }
 
Niraj
buzztouch Evangelist
Profile
Posts: 2943
Reg: Jul 11, 2012
Cerritos
37,930
like
12/03/14 09:53 PM (9 years ago)
Thank you for sharing! When you get the app approved and published, please try to do these things: 1. Share your changes to the BuzzTouch code in a single post 2. Let us know of the app so that we can delight in it -- Niraj
 
Hmmm
buzztouch Evangelist
Profile
Posts: 67
Reg: Sep 17, 2013
location unknow...
6,670
like
12/03/14 09:58 PM (9 years ago)
Will do. Thanks.
 

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.