I am trying to debug an iPhone application created by a contractor that is no longer with us. My background is C#, and am not familiar with Objective C at all. I was wondering if someone here could interpret a piece of code for me.
To give a little bit of a background, the application is providing latitude/longitude coordinates to a .NET service through a request object.
(void)ShowNearestPOI:(CLLocationCoordinate2D)coordinate {
ASIFormDataRequest *theRequest = [ASIFormDataRequest requestWithURL:
[self URLBuilderFunctionWithEndpointName:kServiceIdGetNearestPOI]
];
/*
NSString *tmpGeoLatString = [[NSString stringWithFormat:@"%2开发者_开发问答.6f", coordinate.latitude] stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
NSString *tmpGeoLongString = [[NSString stringWithFormat:@"%2.6f", coordinate.longitude] stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
[theRequest setPostValue:tmpGeoLatString forKey:@"latitude"];
[theRequest setPostValue:tmpGeoLongString forKey:@"longitude"];
*/
[theRequest setPostValue:@"1" forKey:@"latitude"];
[theRequest setPostValue:@"1" forKey:@"longitude"];
[theRequest setPostValue:kINGMethodNameGetNearestPOI forKey:@"method"];
[theRequest addRequestHeader:@"User-Agent" value:kCustomUserAgent];
[theRequest setDelegate:self];
[theRequest startAsynchronous];
request_state = 1; // Loading please wait
}
What I want to know is whether the contractor has hardcoded the latitude and longitude with 1 and 1 respectively. The two lines I believe this is happening in are below:
[theRequest setPostValue:@"1" forKey:@"latitude"];
[theRequest setPostValue:@"1" forKey:@"longitude"];
Any help will be appreciated. Cheers!
Yes that's exactly what is happening. By the looks of it, they wanted to make sure the post was getting through, to the server, rather than there being an error in the string formatting code above it?
精彩评论