How to add a new property to the GMSMarker class?

0

How to add a new property to this class.

I added it to the GMSMarker.h file, but when I tried to use the new property I got this error:

  

- [GMSMarker setId:]: unrecognized selector sent to instance 0x790cd410 2015-02-27 13: 26: 44.340 Testing [7174: 108607]   *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '- [GMSMarker setIdRegister:]:   unrecognized selector sent to instance 0x790cd410 '

    
asked by anonymous 27.02.2015 / 17:31

1 answer

0

I was able to resolve declaring a new class, inheriting GMSMarker.

In the declaration of the new class I include the desired new property, and then I synthesized it.

MeuMarker.h

#import <GoogleMaps/GoogleMaps.h>

@interface MeuMarker : GMSMarker

@property (nonatomic, strong) NSString* idRegistroTocado;

@end

MyMarker.m

#import "MeuMarker.h"

@implementation MeuMarker

@synthesize idRegistroTocado;

@end

Usage

MeuMarker* marker = [[MeuMarker alloc]init];

marker.position = position;
marker.title = dadosRegistros.nome;
marker.snippet = dadosRegistros.rua;
marker.idRegistroTocado = dadosRegistros.idRegistro;
    
27.02.2015 / 18:35