Old code gives “Unused parameter” error but never has before now

孤人 提交于 2019-12-05 03:35:45
Michael Dautermann

Solution # 1)

In your Xcode project's "Build Settings", there's a parameter for "Unused Parameters".

Reset that from YES to NO.

Solution # 2 (available with Xcode 4):

In Xcode 4.3.2 or higher use __unused.

(THANKS to Tim Bodeit's comment below)

Solution # 3)

Put #pragma unused (searchBar) in your code, preferably right underneath the line in your implementation where the function is declared.

I.E.

- (void)searchBarTextDidBeginEditing:(UISearchBar *)searchBar {
    #pragma unused (searchBar)
    NSLog(@"Search Bar isn't used in this function");
}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!