Search code examples
xcode4

UIAlertView buttonClickedAtIndex Duplicate Declarations


I am using 2 UIAlertViews in 2 different view controllers. In my second viewController I can't use the buttonClickedAtIndex to retrieve button clicked because I've already declared it in the other view. I get an error. "Duplicate Declaration of buttonClickedAtIndex" How can I reuse that function in the same project. Sorry no code, I'm at work on a PC.


Solution

  • Did you, by any chance, copy the ViewController files? Check the class names and headers very carefully. Make sure they are not the same. What you might have done is copied the ViewController.m file, and because they're the same name, it thinks you're trying to reimplement the method twice in the same class.

    All things being right, you should not get this error, since it is bound to what is defined in the @interface definition anyway.