objective c - Why NSNumber truncate double value? -


it's function talked

- (void)getaddressfromlatlon:(double)pdbllatitude withlongitude:    (double)pdbllongitude             {                 nsdictionary *adresswithltln = @{                      @"latitude":[nsnumber numberwithdouble:pdbllatitude],                     @"longtitude":[nsnumber numberwithdouble:pdbllongtitude]};               [[nsnotificationcenter defaultcenter]postnotificationname:@"useraddress" object:adresswithltln];         } 

listener:

- (void)didgetaddressnotification:(nsnotification*)notification {     if ([notification object]!=nil){     nsdictionary *nott = [notification object];     if( nott!=null ){          currentaddress=nott;     }    }}     

button action

 - (ibaction)pressbuttonorder:(id)sender {             if ([currentaddress count]>0){                  order *order = [[order alloc]init];                 [order sendorder:[currentaddress objectforkey:@"latitude"] source_lng:[currentaddress objectforkey:@"longtitude"]];              }             } 

and sender

 -(void)sendorder:(nsnumber*)source_lat source_lng:(nsnumber*)source_lng;         {             api *api=[[api alloc]init] ;              nsdictionary *params = @{                                      @"imei":[api getudid] ,                                      @"source_lat":source_lat,                                      @"source_lng":source_lng                                      };               afhttprequestoperationmanager *manager = [afhttprequestoperationmanager manager];             manager.responseserializer.acceptablecontenttypes = [nsset setwithobject:@"text/html"];              [manager post:@"http://" parameters:params                       success:                   ^(afhttprequestoperation *operation, id responseobject)              {               // code…                   }                     failure:^(afhttprequestoperation *operation, nserror *error)              {                   nslog(@"error json: %@", error);                    }              ];             } 

if values are:

      pdbllatitude=  48.514266999999997     pdbllongitude= 32.256956000000002  

in result have:

 form/post parameters      source_lat: 48.514267     source_lng: 32.256956 

typo:

- (void)getaddressfromlatlon:(double)pdbllatitude withlongitude:(double)pdbllongitude {     nsdictionary *adresswithltln = @{          @"latitude":[nsnumber numberwithdouble:pdbllatitude],         @"longtitude":[nsnumber numberwithdouble:pdbllatitude]};                                                      ^^^^^^^^ } 

you meant store longitude didn't you...

edit: doesn't cover truncation aspect, results show strings, else happening values have not disclosed yet.


Comments

Popular posts from this blog

javascript - oscilloscope of speaker input stops rendering after a few seconds -

javascript - gulp-nodemon - nodejs restart after file change - Error: listen EADDRINUSE events.js:85 -

Fatal Python error: Py_Initialize: unable to load the file system codec. ImportError: No module named 'encodings' -