在自定义完整处理程序中使用时,NSURLConnection委托不会触发

时间:2014-03-18 21:59:27

标签: ios nsurlconnection

当我在自定义完整处理程序方法中使用NSURLConnection时。委托方法没有触发。所以我要做的就是让它成功。我想在收到网址时执行操作。

[self exportTo:asset withHandler:^(NSURL *url, NSError *error){
                        NSLog(@"URL : %@, error: %@", url, error);

                        NSString *urlString = @"";

                        // setting up the request object now
                        NSMutableURLRequest *request = [[NSMutableURLRequest alloc] init];
                        [request setURL:[NSURL URLWithString:urlString]];
                        [request setHTTPMethod:@"POST"];

                        NSString *boundary = @"---------------------------14737809831466499882746641449";
                        NSString *contentType = [NSString stringWithFormat:@"multipart/form-data; boundary=%@",boundary];
                        [request addValue:contentType forHTTPHeaderField: @"Content-Type"];


                        NSMutableData *body = [NSMutableData data];



                        [request setHTTPBody:body];
                        NSURLConnection *conn=[[NSURLConnection alloc] initWithRequest:request delegate:self];
                        if (conn)
                        {

                        }
                        else
                        {
                            // inform the user that the download could not be made
                            // NSLog(@"failed to send");
                        }
                    }];

0 个答案:

没有答案