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”

后端 未结 3 502
走了就别回头了
走了就别回头了 2020-12-03 14:41

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

3条回答
  •  情书的邮戳
    2020-12-03 15:26

    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.

提交回复
热议问题