奇怪的prb与NSUrlRequest

时间:2015-02-03 19:26:27

标签: objective-c session nsurlrequest ios8.1

我尝试通过NSSession downloadTaskWithRequest发送一个带有NSURLRequest的大字符串30k但是没有发送所有数据?

-(NSURLRequest*) GetMySQLCommand
{
    NSString *StringToSend = [NSString stringWithFormat: POST_SEND_SQL, _myHashIdstr, _mySQLType, _mySQLStringCommand, _mySQLProcReturn, _myStrId];

    NSLog(@"-----> Post Data = %@", StringToSend);

    NSData *postData = [StringToSend dataUsingEncoding:NSUTF8StringEncoding allowLossyConversion:NO];

    NSString *postLength = [NSString stringWithFormat:@"%llu", (unsigned long long)[postData length]];

    NSLog(@"-----> Post Data to send = %@", postLength);

    _myRequest = [[NSMutableURLRequest alloc] init];

    [_myRequest setHTTPMethod:@"POST"];
    [_myRequest setURL:[NSURL URLWithString:_myIpAdress0]];
    [_myRequest setValue:postLength forHTTPHeaderField:@"Content-Length"];
    [_myRequest setValue:@"text/json; charset=utf-8" forHTTPHeaderField:@"Content-Type"];

    [_myRequest setHTTPBody:postData];

    return _myRequest;
}

0 个答案:

没有答案