簡單的問題,但這給了我一個錯誤,我似乎無法解決它。調用對象的方法給SIGBART
在我對象(的UIViewController)我已經宣佈在.h
的方法,並在.m
-(void)setCurrentLoc:(CLLocation *)loc
{
currentLocation = loc;
}
都很好。但是,這是我如何啓動這一對象(正常工作),但是當我打電話setCurrentLoc:
它給SIGBART
.h
IBOutlet VectorViewController *vectorView;
.m
vectorView = [[VectorViewController alloc] init];
...
//In another method I call:
[vectorView setCurrentLoc:location]; // Error/SIGBART line
有什麼我錯過了什麼?也許不會讓它成爲全球或什麼?
錯誤:
-[UIView setCurrentLoc:]: unrecognized selector sent to instance 0x841cab0
您是否聲明併合成了currentLocation?也許你應該使用self.currentLocation = loc; – alinoz
是的,我做過了,但事實並非如此,這給了錯誤......它調用了方法。 – LouwHopley