Can't troubleshoot this error in my program. *Need Help!*

Discussion in 'iOS Programming' started by iJustinCabral, Jul 17, 2012.

  1. iJustinCabral macrumors member

    iJustinCabral

    Joined:
    Jul 8, 2012
    #1
    Code:
    - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
    {
    if ([segue.identifier isEqualToString:@"AddItem"]) {
    UINavigationController *navigationController = segue.destinationViewController;
    AddItemViewController *controller = (AddItemViewController *)navigationController.topViewController;
    [U]controller.delegate = self;[/U]
    }
    }
    
    I'm trying to add this piece of code in, but I get an error saying:

    "Property 'delegate' cannot be found in forward class object 'AddItemViewController*'


    Is there a step that I might of over looked, or something that has to be done on the story board? I've tried to backtrack and trouble shoot but I cant get it,
    If anyone can help, I'd appreciate it.
     
  2. robbieduncan Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #2
    Does AddItemViewController actually have a delegate property? Show us the code for it
     
  3. PBG4 Dude macrumors 68000

    PBG4 Dude

    Joined:
    Jul 6, 2007
    #3
    Does your view controller conform to the delegate protocol? You would have to set this in your .h file.
     
  4. PhoneyDeveloper macrumors 68030

    PhoneyDeveloper

    Joined:
    Sep 2, 2008
    #4
    Did you #import the header for AddItemViewController?

    What happens if you try

    [controller setDelegate:self];
     

Share This Page