I'm getting the above error, and I don't know why. The line where the error is flagged is:
- (IBAction)cancelButton:(UIBarButtonItem *)sender
{
[self.delegate addActivityViewControllerDidCancel:self.thisActivity];
}
I'm confused because there seems to be no problem with this method, immediately preceding:
- (IBAction)saveButton:(UIBarButtonItem *)sender
...
[self.delegate addViewControllerDidSave];
}
...
}
My protocol is declared like this in the associated header file:
@protocol AddActivityViewControllerDelegate <NSObject>
-(void) addViewControllerDidSave;
-(void) addViewControllerDidCancel:(WMDGActivity *) activityToDelete;
@end
and the methods are implemented like this in the delegate object:
-(void) addActivityViewControllerDidSave
{
NSManagedObjectContext *localContext = [NSManagedObjectContext MR_contextForCurrentThread];
[localContext MR_saveToPersistentStoreAndWait];
[self.navigationController dismissViewControllerAnimated:YES completion:nil];
[self refreshData];
}
-(void) addActivityViewControllerDidCancel:(WMDGActivity *) activityToDelete
{
[activityToDelete MR_deleteEntity];
[self.navigationController dismissViewControllerAnimated:YES completion:nil];
[self refreshData];
}
Can someone please point out my mistake?
Edit:
There is indeed a naming problem (I was pasting in from a test app). However, I have corrected it, I believe, like so:
@protocol AddActivityViewControllerDelegate <NSObject>
-(void) AddActivityViewControllerDidSave;
-(void) AddActivityViewControllerDidCancel:(WMDGActivity *) activityToDelete;
@end
And
- (IBAction)saveButton:(UIBarButtonItem *)sender
{
...
[self.delegate AddActivityViewControllerDidSave];
...
}
And
- (IBAction)cancelButton:(UIBarButtonItem *)sender
{
[self.delegate addActivityViewControllerDidCancel:self.thisActivity];
}
And
-(void) addActivityViewControllerDidSave
{
NSManagedObjectContext *localContext = [NSManagedObjectContext MR_contextForCurrentThread];
[localContext MR_saveToPersistentStoreAndWait];
[self.navigationController dismissViewControllerAnimated:YES completion:nil];
[self refreshData];
}
-(void) addActivityViewControllerDidCancel:(WMDGActivity *) activityToDelete
{
[activityToDelete MR_deleteEntity];
[self.navigationController dismissViewControllerAnimated:YES completion:nil];
[self refreshData];
}
Still getting error.
Build fails even with breakpoint suggested by @Leo