为UIPresentationController无可见@interface声明选择initWithPresentingViewController:presentedViewController

问题描述:

我看WWDC 2014的视频A Look Inside Presentation Controllers
我下载会话的源代码(写在Objective-C),尝试构建它,我得到这个错误:为UIPresentationController无可见@interface声明选择initWithPresentingViewController:presentedViewController

No visible @interface for UIPresentationController declares the selector initWithPresentingViewController:presentedViewController.

该方法是否假设在UIPresentationController

我从UIPresentationController的文档中找到答案,该方法应该是 - (instancetype)initWithPresentedViewController (UIViewController *)presentedViewController presentingViewController:(UIViewController*)presentingViewController;而不是-(instancetype)initWithPresentingViewController:(UIViewController *)presentingViewController presentedViewController:(UIViewController *)presentedViewController。 只要我改变它就修复了问题