Ios 为什么在UINavigationController中无法识别委托协议方法

Ios 为什么在UINavigationController中无法识别委托协议方法,ios,objective-c,delegates,Ios,Objective C,Delegates,我看了很多关于委派的帖子,但找不到为什么这不起作用 我在Xcode 5的故事板中有UINavigationController,下面是如何分配代理的: 在MasterViewController中,我有: // // MasterViewController.h // @protocol MyViewDelegate @required - (void) getBackContacts:(NSArray *)c andEmails:(NSArray *)e; @end @interface L

我看了很多关于委派的帖子,但找不到为什么这不起作用 我在Xcode 5的故事板中有UINavigationController,下面是如何分配代理的: 在MasterViewController中,我有:

//
// MasterViewController.h
//
@protocol MyViewDelegate
@required
- (void) getBackContacts:(NSArray *)c andEmails:(NSArray *)e;
@end

@interface ListContactsViewController : UITableViewController <MyViewDelegate> {

}
@property (strong, nonatomic) NSString* myString;
@property (strong, nonatomic) ABContact* currentML;

@end


//
// MasterViewController.m
//

- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
    DetailtViewController *vc = [segue destinationViewController];
    vc.delegate = self;
    vc.currentML = _currentML;
    vc.contacts = _contacts;
    vc.emails = _emails;
}

- (void) getBackContacts:(NSArray *)c andEmails:(NSArray *)e
{
    _contacts = [NSMutableArray arrayWithArray:c];
    _emails   = [NSMutableArray arrayWithArray:e];
}
//
// DetailViewController.h
//
@protocol MyViewDelegate;

@interface SelectContactViewController : UITableViewController {
    id< MyViewDelegate > delegate;

}
-(IBAction) save;

@property (nonatomic, strong) id< MyViewDelegate > delegate;
@property (strong, nonatomic) ABContact* currentML;
@property (strong, nonatomic) NSMutableArray* contacts;
@property (strong, nonatomic) NSMutableArray* emails;


//
// DetailViewController.m
//

- (IBAction) save
{
    // *** this line compiles with error
    [delegate getBackContacts:_contacts andEmails:_emails];
}
//
//MasterViewController.h
//
@协议MyViewDelegate
@必需的
-(void)getBackContacts:(NSArray*)c和mails:(NSArray*)e;
@结束
@接口列表ContactsViewController:UITableViewController{
}
@属性(强,非原子)NSString*myString;
@属性(强,非原子)ABContact*currentML;
@结束
//
//MasterViewController.m
//
-(void)prepareForSegue:(UIStoryboardSegue*)segue发送方:(id)发送方
{
//使用[segue destinationViewController]获取新的视图控制器。
//将选定对象传递给新的视图控制器。
DetailtViewController*vc=[segue destinationViewController];
vc.delegate=self;
vc.currentML=_currentML;
vc.contacts=_contacts;
vc.emails=_电子邮件;
}
-(无效)getBackContacts:(NSArray*)c和邮件:(NSArray*)e
{
_contacts=[NSMutableArrayWithArray:c];
_电子邮件=[NSMUTABLEARRY ARRAY WITHARRAY:e];
}
对于DetailViewController,我有:

//
// MasterViewController.h
//
@protocol MyViewDelegate
@required
- (void) getBackContacts:(NSArray *)c andEmails:(NSArray *)e;
@end

@interface ListContactsViewController : UITableViewController <MyViewDelegate> {

}
@property (strong, nonatomic) NSString* myString;
@property (strong, nonatomic) ABContact* currentML;

@end


//
// MasterViewController.m
//

- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
    DetailtViewController *vc = [segue destinationViewController];
    vc.delegate = self;
    vc.currentML = _currentML;
    vc.contacts = _contacts;
    vc.emails = _emails;
}

- (void) getBackContacts:(NSArray *)c andEmails:(NSArray *)e
{
    _contacts = [NSMutableArray arrayWithArray:c];
    _emails   = [NSMutableArray arrayWithArray:e];
}
//
// DetailViewController.h
//
@protocol MyViewDelegate;

@interface SelectContactViewController : UITableViewController {
    id< MyViewDelegate > delegate;

}
-(IBAction) save;

@property (nonatomic, strong) id< MyViewDelegate > delegate;
@property (strong, nonatomic) ABContact* currentML;
@property (strong, nonatomic) NSMutableArray* contacts;
@property (strong, nonatomic) NSMutableArray* emails;


//
// DetailViewController.m
//

- (IBAction) save
{
    // *** this line compiles with error
    [delegate getBackContacts:_contacts andEmails:_emails];
}
//
//DetailViewController.h
//
@协议代表;
@界面选择ContactViewController:UITableViewController{
iddelegate;
}
-(i)保存;
@属性(非原子,强)iddelegate;
@属性(强,非原子)ABContact*currentML;
@属性(强,非原子)NSMutableArray*触点;
@属性(强,非原子)NSMutableArray*电子邮件;
//
//DetailViewController.m
//
-(i)保存
{
//***此行编译时出错
[代表getBackContacts:_Contactsand emails:_emails];
}
当我编译时,编译器说:


选择器“getBackContacts:andEmails:”没有已知的实例方法。

如果没有看到协议的完整定义,那么您希望编译器如何知道协议声明的方法?换句话说,
#在
DetailViewController.m
中导入“MasterViewController.h”
。噢!你不知道我在代理声明中搜索问题花了多少小时!谢谢你,伙计!很少有理由对协议使用转发声明。你能解释一下转发声明是什么意思吗?