Xcode compiler warning: "foo" may not respond to -bar

I am trying to get around Objective-C for iPhone. My application compiles and still works fine, but I get a compiler warning that I can’t get rid of.

Title for one class: (snipped)

@interface PersonDetailViewController : UIViewController {
    NSDictionary *person;
}
@property (retain) NSDictionary *person;
@end

Implementation for this class: (also disabled)

#import "PersonDetailViewController.h"
@implementation PersonDetailViewController
@synthesize person;
@end

I create an instance of PersonDetailViewController in PersonListViewController and call:

#import "PersonListViewController.h"
#import "Person.h"
#import "PersonDetailViewController.h"

@implementation PersonListViewController
- (IBAction)myMethod:(id)sender {
    NSDictionary *person = [[Person alloc] initFromTestArray:[sender tag]];
    [personDetailViewController setPerson:person];
    [[personDetailViewController person] describe];
}
@end

And they tell me that:

warning: 'UIViewController' may not respond to '-setPerson' (Messages without a matching method signature will be assumed to return 'id' and accept '...' as arguments.)
warning: 'UIViewController' may not respond to '-person'

it really responds just fine, but I can’t figure out how to organize my headers so that the compiler knows it will respond ...

I’m all from Google ... hope I have given enough information and someone can help.

Thanks heap!

+3
source share
2

, personDetailViewController, UIViewController? :

[(PersonDetailViewController*)personDetailViewController setPerson:person];

. personDetailViewController personDetailViewController PersonListViewController. , , :)

+4

... :

NSDictionary *person = [[Person alloc] initFromTestArray:[sender tag]];

NSDictionary, Person...

Person *person = [[Person alloc] initFromTestArray:[sender tag]];

@property , , ... - , !

+2

Source: https://habr.com/ru/post/1712999/


All Articles