问题
I'm developing an iPad app to help me to manage my expenses when I'm abroad.
I have a split view with the classical master and detail views. In the master there is the list of the expenses and in the detail view, guess what? The details of every expense! When I tap on a button in the detail a new view is loaded using a modal segue with a Form Sheet. The user insert a number and if that number is bigger than a certain value the colors of the labels in the master and in the detail will change. When I save this number I dismiss the modal view and send a NSMessage to the master in order to reload the table with the new label colors and reload the detail view selected previously. Everything work using the iOS Simulator, but when I run the app on my iPad (iPad 2), everything freeze and I got this message:
2013-11-09 21:52:04.763 IOUinTravel[562:60b] -[NSConcreteMapTable backdropView:willChangeToGraphicsQuality:]: unrecognized selector sent to instance 0x18b8fb00 2013-11-09 21:52:04.767 IOUinTravel[562:60b] * Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSConcreteMapTable backdropView:willChangeToGraphicsQuality:]: unrecognized selector sent to instance 0x18b8fb00' * First throw call stack: (0x2df5bf4b 0x387386af 0x2df5f8e7 0x2df5e1cb 0x2dead4d8 0x30c88b43 0x306cd7b5 0x306cd6e5 0x306cd7d5 0x306cd6e5 0x306da5c3 0x306da417 0x30785f67 0x30785d83 0x3077de85 0x3077d30d 0x3077d07d 0x3077d015 0x306ceda3 0x30355c6b 0x3035147b 0x3035130d 0x30350d1f 0x30350b2f 0x306c70c3 0x2df271cd 0x2df24b71 0x2df24eb3 0x2de8fc27 0x2de8fa0b 0x32b70283 0x30733049 0x9a3d5 0x38c40ab7) libc++abi.dylib: terminating with uncaught exception of type NSException (lldb)
I really do not know why and how to solve it.
The methods I've used are:
In the Form Sheet modal view:
- (IBAction)saveNumber:(id)sender {
// Do some stuff here
[self dismissViewControllerAnimated:YES completion:^{ [[NSNotificationCenter defaultCenter] postNotificationName:@"reloadAfterExpenseCheck" object:self];}];
}
In the main view:
- (void)reloadAfterExpenseCheck:(NSNotification *)notification
{
if ([[notification name] isEqualToString:@"reloadAfterExpenseCheck"]) {
NSLog(@"Messaggio ricevuto!");
NSLog(@"%@", self.indexPathToUpdate);
[self.tableView reloadData];
[self.tableView selectRowAtIndexPath:self.indexPathToUpdate animated:NO scrollPosition:UITableViewScrollPositionNone];
[self performSegueWithIdentifier:@"detailExpense" sender:self];
}
}
The segue @"detailExpense" works when I trigger it selecting a cell in the master table, so I do not know where is the problem... in the iOS sim it works!
Thank you for your answers.
回答1:
I've solved this problem, I do not know it it is the best way but it works now.
I started to think that maybe there could be some asynchronous task going on. My Mac Mini cpu was fast enough to complete the first task, load the view and fill it with my data, the iPad cpu maybe was too slow so the view wasn't loaded... at least that is my guess. I've simple added a NSTimer that fires the method used to load the detail view after a short time. The user do not notice the delay but it gives time to the iPad.
That's the code:
- (void)reloadAfterExpenseCheck:(NSNotification *)notification {
if ([[notification name] isEqualToString:@"reloadAfterExpenseCheck"]) {
[self.tableView reloadData];
[self.tableView selectRowAtIndexPath:self.indexPathToUpdate animated:NO scrollPosition:UITableViewScrollPositionNone];
//[self performSegueWithIdentifier:@"detailExpense" sender:self];
[NSTimer scheduledTimerWithTimeInterval:0.05 target:self selector:@selector(loadIt) userInfo:nil repeats:NO];
}
}
-(void)loadIt
{
[self performSegueWithIdentifier:@"detailExpense" sender:self];
}
来源:https://stackoverflow.com/questions/19883238/nsconcretemaptable-backdropviewwillchangetographicsquality-error