2010-11-30 43 views
1

我正在嘗試調試由不再與我們合作的承建商創建的iPhone應用程序。我的背景是C#,並且我根本不熟悉Objective 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"]; 

任何幫助將不勝感激。乾杯!

回答

2

是的,這正是發生的事情。從外觀上看,他們希望確保帖子能夠通過服務器,而不是在上面的字符串格式代碼中出現錯誤?

+0

Arggggh!多煩人! – 2010-11-30 23:41:07