ios - 找不到“MapViewControllerDelegate”的协议声明;你的意思是“UIPageViewControllerDelegate”吗?
问题描述
我有一个用目标 C 编写的应用程序,我在 2 个月前上传了一个新版本,一切正常,现在我想添加一些东西,但我收到这个错误:找不到协议声明MapViewControllerDelegate
;你的意思是UIPageViewControllerDelegate
?
#import <UIKit/UIKit.h>
@protocol MapViewControllerDelegate <NSObject>
-(void)closeViewController;
@end
@interface RoomServiceViewController : UIViewController
@property (weak,nonatomic) id <MapViewControllerDelegate> delegate;
@end
找不到协议声明MapViewControllerDelegate
;你的意思是UIPageViewControllerDelegate
?
替换MapViewControllerDelegate
为UIPageViewControllerDelegate
引用MapViewControllerDelegate
不明确
解决方案
由于您标记了 UIPageViewController 并且 XCode 是您的类型与 UIPageViewControllerDelegate 混淆:您在某处是否有一个 UIPageViewController 也指您的协议?
如果是:Objective-C 类型在您的项目中不会自动知道。你需要包含他们的头文件。否则你会得到有趣的最佳猜测。
另外的选择。将协议移动到单独的头文件中,看看是否可以解决问题。
此外,如果您使用 include 而不是 import 您最终会出现奇怪的编译器错误。
推荐阅读
- c# - 将 ComboboxItem 作为复选框绑定到它在列表中的存在?
- javascript - 如何更改 Mapbox Geocoder 搜索栏的大小?
- html - 在ios safari上定位固定元素?
- python - Scrapy:无法创建项目
- javascript - clearInterval 执行后刷新页面
- kotlin - BufferedImage drawString 损坏的字母
- c# - 从 C# 中的 .txt 文件中的单行获取多个子字符串
- amazon-web-services - AWS LastModified S3 存储桶不同
- ios - 使用 firebase 和 swift 合并用户消息
- chromium - 更改主题颜色元属性在 Chromium 中无效