Objective C - 在Request Object中设置变量

时间:2010-11-30 23:29:24

标签: iphone objective-c debugging

我正在尝试调试由不再与我们合作的承包商创建的iPhone应用程序。我的背景是C#,根本不熟悉Objective C.我想知道这里是否有人可以为我解释一段代码。

为了给出一点背景知识,应用程序通过请求对象为.NET服务提供纬度/经度坐标。

(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
}

我想知道的是承包商是否已分别用1和1硬编码纬度和经度。我相信这种情况发生的两条线如下:

[theRequest setPostValue:@"1" forKey:@"latitude"];
[theRequest setPostValue:@"1" forKey:@"longitude"];

任何帮助将不胜感激。干杯!

1 个答案:

答案 0 :(得分:2)

是的,这正是发生的事情。根据它的外观,他们想确保帖子通过服务器,而不是在它上面的字符串格式代码中出现错误?