Reputation: 3543
I have this in my view controller:
[[[UIApplication sharedApplication] delegate] sendMessageAsSingleObject:[sender currentTitle]];
Which gives me this warning:
warning: '-sendMessageAsSingleObject:' not found in protocol(s)
But in my AppDelegate i have the method declared in the header...
I should add that the call works, just want to get rid of the warnings.
Thanks
Upvotes: 1
Views: 1401
Reputation: 6147
[[UIApplication sharedApplication] delegate]
Returns an object that implements the UIApplicationDelegate
protocol. This protocol doesn't have the method sendMessageAsSingleObject
. So your compiler doesn't know that this method is actually there. You need to cast the delegate first to the specific class of your application delegate.
MyAppDelegate *appDelegate = (MyAppDelegate*)[[UIApplication sharedApplication] delegate];
[appDelegate sendMessageAsSingleObject:[sender currentTitle]];
Upvotes: 5