C++ 正在为WebView添加UI栏按钮项,但应用程序崩溃

C++ 正在为WebView添加UI栏按钮项,但应用程序崩溃,c++,ios,iphone,objective-c,xcode,C++,Ios,Iphone,Objective C,Xcode,我已经在XCode中将以下代码添加到我的iOS项目中。它允许我向iNavigation控制器添加多个按钮-应用程序中的项目显示良好,但当我按下“刷新”或“返回”按钮时,应用程序崩溃 我要做的是创建3个按钮-刷新、返回和前进 我收到的错误显示未声明的选择器“刷新” // Create the refresh, fixed-space (optional), and profile buttons. UIBarButtonItem *refreshBarButtonItem = [[UIBarBut

我已经在XCode中将以下代码添加到我的iOS项目中。它允许我向iNavigation控制器添加多个按钮-应用程序中的项目显示良好,但当我按下“刷新”或“返回”按钮时,应用程序崩溃

我要做的是创建3个按钮-刷新、返回和前进

我收到的错误显示未声明的选择器“刷新”

// Create the refresh, fixed-space (optional), and profile buttons.
UIBarButtonItem *refreshBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemRefresh target:self action:@selector(refresh:)];




//    // Optional: if you want to add space between the refresh & profile buttons
//    UIBarButtonItem *fixedSpaceBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFixedSpace target:nil action:nil];
//    fixedSpaceBarButtonItem.width = 12;

UIBarButtonItem *profileBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"Back" style:UIBarButtonItemStylePlain target:self action:@selector(goToProfile)];
profileBarButtonItem.style = UIBarButtonItemStyleBordered;

self.navigationItem.rightBarButtonItems = @[profileBarButtonItem, /* fixedSpaceBarButtonItem, */ refreshBarButtonItem];
请按照


将在导航栏中添加更多按钮检查刷新方法的声明/定义

根据您的代码操作:@selectorrefresh:;刷新方法应至少有一个参数


如果您对refresh方法的定义没有参数,那么它应该像操作一样:@selectorrefresh

viewcontroller中是否有refresh:方法?