user3396537
user3396537

Reputation: 1

About Property not found Xcode 5 error

Here InformacionViewController.h:

 #import <UIKit/UIKit.h>
 #import "LibrosFenomenales.h"

 @interface InformacionViewController : UIViewController

 @property (strong, nonatomic) IBOutlet UILabel *nombre;
 @property (strong, nonatomic) IBOutlet UILabel *autor;
 @property (strong, nonatomic) IBOutlet UILabel *año;
 @property (strong, nonatomic) IBOutlet UILabel *genero;
 @property (strong, nonatomic) IBOutlet UITextView *argumento;
 @property (strong, nonatomic) IBOutlet UIImageView *portada;
 @property LibrosFenomenales *libroSeleccionado;

 @end

Here ViewController.m:

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
   [tableView deselectRowAtIndexPath:indexPath animated:YES];

   InformacionViewController *informacionViewController = [self.storyboard        
   instantiateViewControllerWithIdentifier:@"InformacionViewController"];
   UINavigationController *navigationController = [[UINavigationController alloc]   
   initWithRootViewController:informacionViewController];

   informacionViewController.libroSeleccionado = [_libros objectAtIndex:indexPath.row];
   [self presentViewController:navigationController animated:YES completion:nil];
}

Xcode shows me this error: Property "libroSeleccionado" not found on object of type "InformacionViewController".

This is the line: informacionViewController.libroSeleccionado = [_libros objectAtIndex:indexPath.row];

What am i doing wrong?

Thanks

Upvotes: 0

Views: 65

Answers (2)

B.R.W.
B.R.W.

Reputation: 1566

Hard to say without having access to the whole code, but try these:

  • If "LibrosFenomenales" is an Objective-C class, change the property declaration to:

    @property (strong, nonatomic) LibrosFenomenales *libroSeleccionado;

  • If the LibrosFenomenales.h header imports the InformacionViewController.h header, you have a cross-referencing issue. To fix this, open up InformacionViewController.h and replace:

    #import "LibrosFenomenales.h"

    by:

    @class LibrosFenomenales;;

    then open up InformacionViewController.m and add the #import "LibrosFenomenales.h" to it.

  • Don't forget to #import "InformacionViewController.m" in ViewController.m

Upvotes: 0

Lloyd Presly
Lloyd Presly

Reputation: 21

Instead of Quiting the Xcode you just First clean the build. To clean the build Press command+Shift+K. then run the application even then If it doesn't work for then try this @property (strong, nonatomic) LibrosFenomenales *libroSeleccionado; instead of @property LibrosFenomenales *libroSeleccionado;

Upvotes: 1

Related Questions