在 Objective-C 中,我想在 Class from Class中设置一个synthesized (assigned)
属性Compass
B
这是我的代码...
for(Compass * ind in CompassList){
if([[(Compass*)ind showAnalog] isEqualToString:str]){
ind.analogValue=11.0;
}
}
但是,我收到此错误...
Request for member analogValue in something not a structure or union.
我设法通过使用我自己的设置器并将其称为[ind updateValue:11.0];
. 但是,当我稍后像在另一个类中调用合成的 getter 时[(Compass*)currentDevice analogValue];
,我得到以下异常......
'NSInvalidArgumentException': [Compass digitalValue]: unrecognized selector sent to instance 0x613ca20
有人可以帮我理解我应该如何做到这一点。