2014-03-19 6 views
0

에 ASIFormDataRequest 교환이 내 코드 오순절 ASI :게시, 내가 <br> 을 afnetworking에서 POST 요청을 수행 할 AFnetworking

내가 AFnetworking에서 같은 끈을 할 수있는 방법을
NSURL *mainurl = [NSURL URLWithString:@"xxxx/api/xxx/"]; 

    ASIFormDataRequest *requestt = [ASIFormDataRequest requestWithURL:mainurl]; 

    [requestt addPostValue:GETUnicidentifire forKey:@"UniqueId"]; 
    [requestt addPostValue:JsonOrderDetail forKey:@"jsonProduct"]; 
    [requestt addPostValue:BranchId   forKey:@"BranchId"]; 
    [requestt addPostValue:OrderToTime  forKey:@"OrderToTime"]; 

    [requestt setCompletionBlock:^{ 
     // Process the response 




    }]; 
    [requestt setFailedBlock:^{ 
     NSError *error = [requestt error]; 

?

답변

1

하지 정확한 대답,하지만 여기 내 응용 프로그램에서 매우 유사한 POST 요청의 :

_manager = [[AFHTTPRequestOperationManager alloc] initWithBaseURL:[NSURL URLWithString:@"http://192.168.1.1/"]]; 
:

-(void)setGpsLocation:(CLLocation*)location success:(TPScopeInterfaceSuccess)success failure:(TPScopeInterfaceFailure)failure 
{ 
    [_manager POST:@"gps/" 
     parameters:@{ 
        @"lat":@(location.coordinate.latitude), 
        @"lon":@(location.coordinate.longitude), 
        @"height":@(location.altitude), 
        } 
    constructingBodyWithBlock:nil 
      success:success 
      failure:failure]; 
} 

_manager가로 초기화 AFHTTPRequestOperationManager의 인스턴스는