0
votes

I am trying to create the getter setter module and apply to my Control class

when it comes to the compiling, Incompatible Integer to pointer conversion sending 'int' to parameter of type 'int *' is shown at the last line of the code:

  CheckPoints *myCar=[[CheckPoints alloc] init];
    [myCar setState:1];

The below is my CheckPoints.m , CheckPoints.h

.m

#import "CheckPoints.h"

@implementation CheckPoints

@synthesize desp = _desp;
@synthesize latitude = _latitude;
@synthesize longitude = _longitude;
@synthesize state = _state;


- (NSString *) getDesp
{
    return desp;
}

- (float *) getLatitude
{
    return latitude;
}

- (float *) getLongitude
{
    return longitude;
}

- (int *) getState
{
    return state;
}

- (void)setDesp:(NSString *)valueDesp {
    [self setDesp:valueDesp];
}

- (void)setLatitude:(float *)valueLatitude {
  //  self.latitude = valueLatitude;
    [self setLatitude:valueLatitude];
}

- (void)setLongitude:(float *)valueLongitude {
    [self setLongitude:valueLongitude];
}

- (void)setState:(int *)valueState {
    [self setState:valueState];
}

@end

.h

#import <GoogleMaps/GoogleMaps.h>
#import <Foundation/Foundation.h>

@interface CheckPoints : NSObject<CLLocationManagerDelegate> {

    NSString *desp;
    float *latitude;
    float *longitude;
    int *state;
}


@property (nonatomic, assign) NSString* desp;
@property  (nonatomic, assign) float* latitude;
@property  (nonatomic, assign) float* longitude;
@property  (nonatomic, assign) int* state;

- (NSString *)getDesp;
- (Float32 *)getLatitude;
- (Float32 *)getLongitude;
- (int *)getState;

- (void)setDesp:(NSString *)valueDesp;
- (void)setLatitude:(float *)valueLatitude;
- (void)setLongitude:(float *)valueLongitude;
- (void)setState:(int *)valueState;

@end
1
Remove * from int,float .then it will work. - SilentStalker

1 Answers

2
votes

You should remove '*' sign from scalar types. In other words you should change it to:

- (void)setState:(int)valueState {
    [self setState:valueState];
}