Bug? @property with setter

icefairy333

Active Member
Licensed User
Longtime User
B4X:
//this not work

//in .h
//b4i throw error when compile :
//B4i line: *
//mv.showmyloc=True
//no visible @interface for 'iAMap' declares the selector 'setshowmyloc:'

@property (nonatomic,assign)BOOL showmyloc;
//in .m
-(BOOL)showmyloc{
    return [_mapView isShowsUserLocation];
}
-(void)setShowmyloc:(BOOL)showMyLoc{
    [_mapView setShowsUserLocation:showMyLoc];
    [_mapView setUserTrackingMode:MAUserTrackingModeFollow];
}

//in .m(gen by b4i)
[self._mv setshowmyloc:[self.__c True]];

//the right way should be:
[self._mv setShowmyloc:[self.__c True]];

//no error with getter
B4X:
//this will work
//in .h
@property (nonatomic,assign)BOOL SHOWSCALE;
//in .m
-(BOOL)SHOWSCALE{
    return [_mapView showsScale];
}
-(void)setSHOWSCALE:(BOOL)SHOWSCALE{
    [_mapView setShowsScale:SHOWSCALE];
}

//in .m(gen by b4i)
[self._mv setSHOWSCALE:[self.__c True]];
 

icefairy333

Active Member
Licensed User
Longtime User
the name "setShowmyloc" is auto completed by xcode(8.2+ios 10.2 sdk) not typed by myself.
I've done the test just now,maybe you are wrong.
I've added a prop named testpro and modify the setter method in your way,but the b4i still error with same error:
no visible @interface for 'iAMap' declares the selector 'settestpro:'
B4X:
//in h
@property (nonatomic,assign)BOOL testpro;
//in m
-(BOOL)testpro{
    return true;
}
-(void)settestpro:(BOOL)testpro{
   
}
//the code b4i gen
[self._mv settestpro:[self.__c True]];
with screen cap image:
error.png
 
Top