Reputation: 9320
Visual Studio can tell me the methods that are never called, can XCode do the same? Guess not, since they might be called through selector and the name can be formed on fly.
Upvotes: 3
Views: 2360
Reputation: 185661
There's no true idea of "unused method" in Obj-C. Because everything is invoked via message passing, the compiler may not be able to find any call sites that explicitly invoke that message, and yet it's still invoked via runtime methods.
If you want to figure out if a method is unused, you can do a project-wide search for the method name (if it takes multiple arguments, you could just try the most distinctive portion of the name, e.g. if you have -loadData:MIMEType:textEncodingName:baseURL:
you could search for just MIMEType:
). This will give you a good idea if there's any explicit calls of this method. If you're sure you aren't dynamically constructing method names at runtime, then this may be a method that's never called. But whether or not you can actually be confident in this depends on how complex your project is and how much runtime "magic" you use.
Upvotes: 4