小编soc*_*ian的帖子

NSURLConnection委托方法

我很难找到NSURLConnection委托方法实现的任何示例.

我想通过点击按钮发送带有HTTP帖子的数据.不确定如何制作"提交"屏幕并"提交".(我知道如何使用微调器并将使用它们)

我在botton点击操作下使用此代码,但无法使用任何委托内容.不确定如何使用我当前的设置实现它们.

NSMutableURLRequest *request = 
    [[NSMutableURLRequest alloc] initWithURL:
     [NSURL URLWithString:@"http://myURL.com"]];

    [request setHTTPMethod:@"POST"];

    NSString *postString = [wait stringByAppendingString:co];

    [request setValue:[NSString 
                       stringWithFormat:@"%d", [postString length]] 
   forHTTPHeaderField:@"Content-length"];



    [request setHTTPBody:[postString 
                          dataUsingEncoding:NSUTF8StringEncoding]];

    //[[NSURLConnection alloc] initWithRequest:request delegate:self];
    [NSURLConnection sendSynchronousRequest:request returningResponse:nil error:nil];


    [SVProgressHUD dismissWithSuccess:@"Submission Successful"];
Run Code Online (Sandbox Code Playgroud)

iphone objective-c nsurlconnection ios

9
推荐指数
3
解决办法
3万
查看次数

标签 统计

ios ×1

iphone ×1

nsurlconnection ×1

objective-c ×1