ios - getting -[__NSArrayI integerValue] exception -
2015-07-13 23:56:13.659 icbuses[41867:12770881] -[__nsarrayi intvalue]: unrecognized selector sent instance 0x7fddc8e00e30 2015-07-13 23:56:13.670 icbuses[41867:12770881] * terminating app due uncaught exception 'nsinvalidargumentexception', reason: '-[__nsarrayi intvalue]: unrecognized selector sent instance 0x7fddc8e00e30' * first throw call stack:
he's data parsing class there using data put gps location of bus on map. don't believe i'm calling intvalue on array. separating data nsstrings instantiating class busgps. on instance of class i'm calling intvalue on property of class. please , thank you. data bus location: ( { heading = "-4"; id = 110; lat = "41.66044"; lng = "-91.53468"; }
i need lat , lng in int form use google map api. here code. model object header:
@interface buslocation : nsobject @property (strong, nonatomic) nsstring *lat; @property (strong, nonatomic) nsstring *lng; @property (weak, nonatomic) nsstring *heading; - (instancetype) initwithlat:(nsstring *)lat lng:(nsstring *)lng heading:(nsstring *)heading; @end
the interface:
#import "buslocation.h" @implementation buslocation - (instancetype) initwithlat:(nsstring *)lat lng:(nsstring *)lng heading:(nsstring *)heading { self = [super init]; if (self) { _lat = lat; _lng = lng; _heading = heading; } return self; } @end
he header of mapview
#import <uikit/uikit.h> #import "mapviewcontroller.h" #import "api.h" @class buslocation; @interface mapviewcontroller : uiviewcontroller @property (strong, nonatomic) nsstring *routeagency; @property (strong, nonatomic) nsstring *route; @property (strong, nonatomic) nsarray *buslocation; @property (strong, nonatomic) nsarray *routeinfo; @property (strong, nonatomic) nsstring *testlat; @property int testlatint; @property int testlngint; @property (strong, nonatomic) nsstring *testlng; @property (strong, nonatomic) buslocation *busgps; @end
heres implementation file
#import "mapviewcontroller.h" @import googlemaps; #import "buslocation.h" @interface mapviewcontroller () @end @implementation mapviewcontroller { gmsmapview *busroutemapview_; } - (void)viewdidload { [super viewdidload]; nslog(@"name: %@, agency: %@", self.route, self.routeagency); self.routeinfo = [[api sharedapi] routeinfoagency:self.routeagency route:self.route]; self.buslocation = [[api sharedapi] buslocation:self.routeagency route:self.route]; nslog(@"bus location: %@", self.buslocation); //setup class use google map nsstring *testlat = [self.buslocation valueforkey:@"lat"]; nsstring *testlng = [self.buslocation valueforkey:@"lng"]; nsstring *testheading = [self.buslocation valueforkey:@"heading"]; self.busgps = [[buslocation alloc] initwithlat:testlat lng:testlng heading:testheading]; int testing = [self.busgps.lat intvalue]; // create gmscameraposition tells map display // cooridante gmscameraposition *camera = [gmscameraposition camerawithlatitude:41.4444 longitude:-91 zoom:12]; busroutemapview_ = [gmsmapview mapwithframe:cgrectzero camera:camera]; busroutemapview_.mylocationenabled = yes; self.view = busroutemapview_; // additional setup after loading view nib. } - (void)didreceivememorywarning { [super didreceivememorywarning]; // dispose of resources can recreated. } /* #pragma mark - navigation // in storyboard-based application, want little preparation before navigation - (void)prepareforsegue:(uistoryboardsegue *)segue sender:(id)sender { // new view controller using [segue destinationviewcontroller]. // pass selected object new view controller. } */ @end
Comments
Post a Comment