Error After Upgrading to Xcode 4.6 and iOS 6.1 "Used as the Name of the Previous Parameter Rather Than as Part of the Selector"

Xcode 4.6, used as the name of the previous parameter rather than as part of the selector

Your first method is declaring the selector +addFormatPrice::. With spaces, it looks like

+ (NSString *)addFormatPrice:(double)dblPrice :(BOOL)booRemoveCurSymbol;

This is invoked like [NSString addFormatPrice:0.3 :YES].

What you should do is actually give a name to the previous parameter, such as

+ (NSString *)addFormatPrice:(double)dblPrice removeCurSymbol:(BOOL)booRemoveCurSymbol;

Which would then be invoked like [NSString addFormatPrice:0.3 removeCurSymbol:YES].

Error after upgrading to xcode 4.6 and iOS 6.1 used as the name of the previous parameter rather than as part of the selector

It says that objectType is the name of the NSString object in your method and not part of the method name and it should not be used as objectType: (CLLocationCoordinate2D) objectCoordinate which normally denotes a part of method name.

Ideally you should change,

-(void) getAddress: (NSString *) objectType: (CLLocationCoordinate2D) objectCoordinate

to a more readable,

-(void) getAddress:(NSString *)objectType coordinate:(CLLocationCoordinate2D) objectCoordinate;

The above error can also be fixed by putting a space between objectType and next param in method definition(For eg:- -(void)getAddress:(NSString *)objectType : (CLLocationCoordinate2D)objectCoordinate). Note the space after objectType.

Update:

To answer the question in comments you can use the below line to suppress these warnings:

#pragma clang diagnostic ignored "-Wmissing-selector-name"

Add this in your pch file. I am not sure if this will work for your case where it comes from library but you can try it out. Check this clang-trunk for more details.

How to disable new Xcode 4.6 warning for whole project ? “… used as the name of the previous parameter rather than as part of the selector

So I found this for single file :

#pragma clang diagnostic ignored "-Wmissing-selector-name”

Name I got from here: https://github.com/eerolanguage/clang-trunk/blob/master/test/SemaObjC/warning-missing-selector-name.m

So I put it in precompiled header “Project.pch" and it works for my whole project, I am interested in nicer solution if possible, as user defined build setting for example. I tried it, but not found syntax that worked.

Error when Declaring arguments for a method in objective C

You're missing part of the selector name:

- (void)setWidth:(int)width height:(int)height;
// ^--- You're missing this.

Why are some Callers not displaying in the Show Related Items list (Xcode)?

It looks like this issue is, in fact, caused by the unnamed parameters. I refactored the function to use named parameters:

- (NSString *)createWifiUser:(NSString *)inuser inpassword:(NSString *)inpassword inaccountid:(NSString *)inaccountid
{
//return xml
}

I also refactored the caller to use the named parameters:

self.wsret= [[fpws createWifiUser:wifiname.text inpassword:wifipass.text inaccountid:sharedManager.accountId ] mutableCopy];

The warnings disappeared. And the caller now shows up in the Show Related Items menu.
enter image description here

Documentation from Apple regarding unnamed parameters:
Naming Methods

Use keywords before all arguments.

command line:2:10: Macro name missing

I checked my macro and found error.

I added earlier RELEASE = 1 to release macros, but because I used spaces(as I do in code),
it became 3 different macroses: RELEASE, =, 1.

So I just fix that and error gone.



Related Topics



Leave a reply



Submit