iphonesdk中的ARC问题

iphonesdk中的ARC问题,iphone,objective-c,automatic-ref-counting,Iphone,Objective C,Automatic Ref Counting,我正在检查github的一个示例项目,我在其中一个类中发现了此错误,其中有许多类,但我仅在此类中找到了门。错误为“receiver type view controller for instance message未使用选择器'loadChapter:forBook'声明方法” 这个方法是错误的 - (void)displayBook: (int)theBook andChapter: (int)theChapter andVerse: (int)theVerse { [((PKRoo

我正在检查github的一个示例项目,我在其中一个类中发现了此错误,其中有许多类,但我仅在此类中找到了门。错误为“receiver type view controller for instance message未使用选择器'loadChapter:forBook'声明方法”

这个方法是错误的

- (void)displayBook: (int)theBook andChapter: (int)theChapter andVerse: (int)theVerse
{

    [((PKRootViewController *)self.parentViewController.parentViewController ) showWaitingIndicator];
    PKWait(//here i got this error
           [self loadChapter:theChapter forBook:theBook];
           //[self.tableView reloadData];
           [self reloadTableCache];
           [(PKHistory *)[PKHistory instance] addPassagewithBook:theBook andChapter:theChapter andVerse:theVerse];
           [self notifyChangedHistory];
           ((PKSettings *)[PKSettings instance]).topVerse = theVerse;
           if (theVerse>1)
           {
               [self.tableView scrollToRowAtIndexPath: [NSIndexPath indexPathForRow:theVerse-1 inSection:0] atScrollPosition:UITableViewScrollPositionTop animated:NO];
           }
           else 
           {
               [self.tableView scrollRectToVisible:CGRectMake(0, 0, 1, 1) animated:NO];
           }
           UITabBarController *tbc = (UITabBarController *)self.parentViewController.parentViewController;
           tbc.selectedIndex = 0;
           );
}
而且这个方法也有这个误差

 - (void)loadChapter: (int)theChapter forBook: (int)theBook
    {
        // clear selectedVerses
        selectedVerses = [[NSMutableDictionary alloc] init];
        PKSettings *theSettings = [PKSettings instance];
        theSettings.currentBook = theBook;
        theSettings.currentChapter = theChapter;
        //[theSettings saveCurrentReference]; -- removed for speed
        [self loadChapter];//here i got the error,,in this case after selector'loadChapter;
    }

此错误的原因是什么,在显示错误的窗口中,自动引用计算问题是否有不带参数的选择器加载章节


还可以检查它们的声明是否包含在接口文件中

错误
接收器类型视图控制器例如消息未使用选择器'loadChapter:forBook'声明方法
意味着编译器无法在
self
的接口声明中找到方法
loadChapter:forBook:
同样的想法也发生在另一个错误上,但是使用方法
loadChapter
。所以问题可能是您忘记了在接口上声明方法,或者您声明了两个同名的方法。

@Saad对此没有接口声明…但这是一个方法-(void)loadChapter:(int)书的章节:(int)这本书{…那为什么需要在接口中声明呢?因为你正在访问这个方法,而编译器不知道这个方法,因为你还没有声明它,你必须预定义所有你以后想使用的东西,比如一个变量,如果你不定义它,它将生成一个错误,同样的事情在这里,在ARC中,你要么用int声明它在其用法之上的实现中面对或定义它,我的意思是在访问它的方法之上告诉我,如果你得到了Saad的解决方案,那么我可以声明这个-(void)loadChapter:(int)Book的章:(int)接口中的Book吗?当然你可以,事实上你应该,也可以声明-(void)loadChapter;