I'm working with an app utilizing RestKit (which may or may not be relevant to the issue I'm having) in which the app wakes up for a few seconds after certain intervals and makes a managedObjectRequestOperation to a server. This works perfectly all day long, but typically between about 1am and 7am when my device is sitting charging having not been used in a few hours the request gets sent but I'm not registering any sort of response.
The requests don't seem to be timing out or any other similar errors, my logs print that I'm sending a request and then nothing happens at all, no response, no error... Does the phone go into some sort of coma-mode overnight? My device is an iPhone 5 running iOS7.
EDIT:
What I was basically doing is sending a request to a server and updating core data with the results, which then updates a tableView. My original implementation basically sent an NSNotification to the app, which tells a tableview to send a request and update itself according to the results, similar to this:
-(void)application:(UIApplication *)application performFetchWithCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler {
[[NSNotificationCenter defaultCenter] postNotificationName:@"RefreshData" object:nil];
completionHandler(UIBackgroundFetchResultNewData);
}
When really it should be doing this:
-(void)application:(UIApplication *)application performFetchWithCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler {
[RefreshDataWithCompletionHandler:(void (^)(id result))completionHandler {
// handle updating the data here based on the result of the request to the server
......
// then call the completion handler here
completionHandler(UIBackgroundFetchResultNewData);
}];
}
Is that a more accurate representation of the correct steps?