如何调用connection:didReceiveData

时间:2015-07-06 04:43:48

标签: ios objective-c http-post

现在我正在我的iOS应用程序中发布POST,而在POST中我有这个

NSURLConnection *connection = [[NSURLConnection alloc] initWithRequest:request delegate:self startImmediately:YES]; // Edited

这样- (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response {将被调用,但它已经完成,但是没有使用连接会发出警告,我知道这不是调用它的正确方法,所以我怎么能声明一个连接呢是didRecieveResposedidReceiveData

由于

1 个答案:

答案 0 :(得分:2)

您可以这样声明: -

(void) [[NSURLConnection alloc] initWithRequest:request delegate:self];

[NSURLConnection connectionWithRequest:request delegate:self];