I creating my own class with a custom initWithCoord that takes one (struct CLLocationCoordinate2D*) as parameter.
Even though I think I have the correct parameter type, I still get the "incompatible type for argument 1 of 'initWithCoord:" What am I doing wrong:
PeopleStub.m:
#import "PeopleStub.h"
@implementation PeopleStub
-(id)initWithCoord:(struct CLLocationCoordinate2D*)coord{
if(self = [super init]){
people = [[NSMutableDictionary alloc] init];
}
return self;
}
@en开发者_开发百科d
PeopleStub.h
#import <Foundation/Foundation.h>
@interface PeopleStub : NSObject {
NSMutableDictionary *people;
}
-(id)initWithCoord:(struct CLLocationCoordinate2D*)coord;
@end
My way of creating an instance of PeopleStub:
PeopleStub *peopleStub = [[PeopleStub alloc] initWithCoord:locationManager.location.coordinate;
Thanks in advance!
You probably want to be passing just the CLLocationCooridnate2D
, not a pointer to same as the parameter. So:
-(id)initWithCoord:(CLLocationCoordinate2D)coord;
精彩评论