Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
705 views
in Technique[技术] by (71.8m points)

objective c - 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"

After updating to xcode 4.6 and ios6.1, I get this new error "'objectType' used as the name of the previous parameter rather than as part of the selector". I get this multiple times. Any ideas?

PS: The method that it get displayed is a custom one for reverse geocoding.

-(void) getAddress: (NSString *) objectType: (CLLocationCoordinate2D) objectCoordinate
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...