更新到Xcode的4.6和ios6.1后,我得到“用作先前参数的名称,而不是选择的一部分的‘ObjectType’”这个新的错误。 我得到这个多次。 有任何想法吗?
PS:它得到显示的方法是一个自定义的反向地理编码。
-(void) getAddress: (NSString *) objectType: (CLLocationCoordinate2D) objectCoordinate
更新到Xcode的4.6和ios6.1后,我得到“用作先前参数的名称,而不是选择的一部分的‘ObjectType’”这个新的错误。 我得到这个多次。 有任何想法吗?
PS:它得到显示的方法是一个自定义的反向地理编码。
-(void) getAddress: (NSString *) objectType: (CLLocationCoordinate2D) objectCoordinate
它说objectType
是名称NSString
在你的方法对象,而不是在方法名的一部分,它不应该被用作objectType: (CLLocationCoordinate2D) objectCoordinate
其通常表示方法名的一部分。
理想情况下,你应该改变,
-(void) getAddress: (NSString *) objectType: (CLLocationCoordinate2D) objectCoordinate
到一个更可读的,
-(void) getAddress:(NSString *)objectType coordinate:(CLLocationCoordinate2D) objectCoordinate;
上述错误也可以通过把之间的空间固定objectType
和下PARAM在方法定义(对于例如: - - -(void)getAddress:(NSString *)objectType : (CLLocationCoordinate2D)objectCoordinate
)。 注意后面的空格objectType
。
更新:
在注释回答这个问题,你可以使用下面的线压制这些警告:
#pragma clang diagnostic ignored "-Wmissing-selector-name"
在您的PCH文件添加此。 我不知道这是否会为你的工作情况来自何方库,但你可以尝试一下。 检查这个铛干线的更多细节。
这是所有关于间距,亲爱的 ......作为@马丁r表示回复:这个, debateably更好的问题 ...
“这是足以的第二个参数之前插入一个空间”。
充足的含义,在这里,该关闭的Xcode的地狱..
在这种奇怪的一块syntatic琐事的精神......这是我最喜欢的可可头文件,直到永远。 是的,这些都是有效的方法名,嘿嘿。
@interface NSString (JASillyString)
-:a;
-:a :b;
-:a :b :c;
-:a :b :c :d;
-:a :b :c :d :e;
-:a :b :c :d :e :f;
-:a :b :c :d :e :f :g;
-:a :b :c :d :e :f :g :h;
-:a :b :c :d :e :f :g :h :i;
-:a :b :c :d :e :f :g :h :i :j;
-:a :b :c :d :e :f :g :h :i :j :k;
-:a :b :c :d :e :f :g :h :i :j :k :l;
-:a :b :c :d :e :f :g :h :i :j :k :l :m;
-:a :b :c :d :e :f :g :h :i :j :k :l :m :n;
-:a :b :c :d :e :f :g :h :i :j :k :l :m :n :o;
-:a :b :c :d :e :f :g :h :i :j :k :l :m :n :o :p;
-:a :b :c :d :e :f :g :h :i :j :k :l :m :n :o :p :q;
-:a :b :c :d :e :f :g :h :i :j :k :l :m :n :o :p :q :r;
-:a :b :c :d :e :f :g :h :i :j :k :l :m :n :o :p :q :r :s;
-:a :b :c :d :e :f :g :h :i :j :k :l :m :n :o :p :q :r :s :t;
-:a :b :c :d :e :f :g :h :i :j :k :l :m :n :o :p :q :r :s :t :u;
-:a :b :c :d :e :f :g :h :i :j :k :l :m :n :o :p :q :r :s :t :u :v;
-:a :b :c :d :e :f :g :h :i :j :k :l :m :n :o :p :q :r :s :t :u :v :w;
-:a :b :c :d :e :f :g :h :i :j :k :l :m :n :o :p :q :r :s :t :u :v :w :x;
-:a :b :c :d :e :f :g :h :i :j :k :l :m :n :o :p :q :r :s :t :u :v :w :x :y;
-:a :b :c :d :e :f :g :h :i :j :k :l :m :n :o :p :q :r :s :t :u :v :w :x :y :z;
@end
你的方法声明选择用空格,
-(NSString *)testMethod:(double)price :(BOOL)flag;
注意提h和.M都是相同的,平等的空间
当retrive梅索德,到时候小心方法及其参数。 像[自TestMethod的:4.5(空间):TRUE];