xcode 找不到“MFMailComposeViewControllerDelegate”的协议声明;你的意思是“UIPageViewControllerDelegate”?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/20886809/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 04:29:51  来源:igfitidea点击:

Cannot find protocol declaration for 'MFMailComposeViewControllerDelegate'; did you mean 'UIPageViewControllerDelegate'?

iosxcode

提问by user2777252

This code :

这段代码:

#import <UIKit/UIKit.h>
#import <MapKit/MapKit.h>
#import <MessageUI/MessageUI.h>
#import "MessageComposerViewController.h"
#import <MessageUI/MFMailComposeViewController.h>

@interface MapViewController : UIViewController <MFMailComposeViewControllerDelegate> // Add the delegate

- (IBAction)showEmail:(id)sender;

{
    IBOutlet MKMapView *mapView;
}

@property (nonatomic, retain) MKMapView *mapView;

@end

This problem or error :

这个问题或错误:

  • Cannot find protocol declaration for 'MFMailComposeViewControllerDelegate'; did you mean 'UIPageViewControllerDelegate'? for this lign : #import "MessageComposerViewController.h"

  • Expected identifier or '(' for this lign : @interface MapViewController : UIViewController // Add the delegate and this lign : {

  • 找不到“MFMailComposeViewControllerDelegate”的协议声明;你的意思是“UIPageViewControllerDelegate”?对于这个灯:#import "MessageComposerViewController.h"

  • 预期标识符或 '(' 这个 lign : @interface MapViewController : UIViewController // 添加委托和这个 lign : {

Thanks for advance. :)

感谢您的提前。:)

采纳答案by Hemant Chittora

Try This,

尝试这个,

    #import <UIKit/UIKit.h>
    #import <MapKit/MapKit.h>
    #import <MessageUI/MessageUI.h>
    #import "MessageComposerViewController.h"
    #import <MessageUI/MFMailComposeViewController.h>

    @interface MapViewController : UIViewController <MFMailComposeViewControllerDelegate,UINavigationControllerDelegate> {
      IBOutlet MKMapView *mapView;
   }
    - (IBAction)showEmail:(id)sender;
    @property (nonatomic, retain) MKMapView *mapView; 
    @end

回答by Wilson Toussaint Jr.

If you do the above and still see the warning in Xcode, try building or building & running your app. Sometimes these warnings linger after you've addressed the problem and are cleared out by a compilation cycle.

如果您执行上述操作后仍然在 Xcode 中看到警告,请尝试构建或构建并运行您的应用程序。有时,在您解决问题后,这些警告仍然存在,并被编译周期清除。

回答by Mion Kovalski

I encountered the same problem today coding an app for ios8. First thing that I did was re-add the framework, but it didn't help. The problem was I ignored libAWDProtobufFacetimeiMessage - a protocol buffer file. I'm no professional to guess why, but when I added both buffer and the framework itself, the error message disappeared. I have posted a screenshot here. Hope my answer helps anyone looking here in the future.

我今天在为 ios8 编写应用程序时遇到了同样的问题。我做的第一件事是重新添加框架,但没有帮助。问题是我忽略了 libAWDProtobufFacetimeiMessage - 一个协议缓冲区文件。我不是专业人士来猜测原因,但是当我同时添加缓冲区和框架本身时,错误消息消失了。我在这里发布了一个屏幕截图。希望我的回答可以帮助任何将来看这里的人。