Advertise here




Advertise here

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

New Xcode 4.3 compiler warnings - categories

BrianSlickBrianSlick Treadmill Desk NinjaNorthern Virginia / DCPosts: 10,358Tutorial Authors, Registered Users @ @ @ @ @ @ @ @
Just opened up a project in Xcode 4.3, and was instantly informed of all kinds of new warnings. Most of them were pretty harmless, like "void" on declaration but "IBAction" on implementation, easily fixed. But there is one that I can't figure out how to correct while still maintaining what I want.

Warning message is:
Category is implementing a method which will also be implemented by its primary class

It's pointing at methods in a category that are intended to be private, and are declared in a class extension within that category. It's also flagging some 3rd-party code, so I'm not the only one apparently doing this wrong.

A specific example is:

ActionValue
ActionValue+BTIAdditions

In ActionValue+BTIAdditions.m, I do this:
@interface ActionValue ()

- (NSString *)textValueFromDate;
- (NSString *)textValueFromPickerValues;

@end

These are private methods used within the category that I do not wish to be public. They are used by some of the public category methods.

The warning itself is placed down where I implement these methods. If you expand the warning to get to where the "original method" is defined, it highlights these lines here in the class extension.

The easy solution is to move these declarations to the .h file, and get rid of the class extension. But then these methods become public, which I don't want.

So, what is the correct way to have private methods in a category? My Googling is revealing what I was already doing.
Post edited by BrianSlick on
BriTer Ideas LLC - WWW | Facebook | Twitter | LinkedIn - Professional iOS App Development. Available for hire.
I can provide personalized help at codementor.io

SlickShopper 2 | Leave a PayPal donation

Free Xcode Tools: NSLog Utility | Getter Utility
GitHub Projects: BTIKit | BTICoreDataKit

Are you a newbie? Things you should read:
Definitive Guide To Properties | UITableView Series | A Model (Object) Is A Beautiful Thing

Replies

Sign In or Register to comment.