IPhoneApplicationASIFormDataRequestPOST OperationArchitectureDesign is the content to be introduced in this article. It teaches you how to learn about iphone application development.Architecture. Let's talk about the details.
// Enable the iphone network switch
- [UIApplication sharedApplication].networkActivityIndicatorVisible = YES;
- ASIFormDataRequest *request = [[ASIFormDataRequest alloc] initWithURL:[NSURLURLWithString:host]];
// Timeout
- request.timeOutSeconds = 30;
// Define the Asynchronous Method
- [request setDelegate:self];
- [request setDidFailSelector:@selector(requestDidFailed:)];
- [request setDidFinishSelector:@selector(requestDidSuccess:)];
// User-defined data dictionary type (optional)
- request.userInfo = [NSDictionary dictionaryWithObject:method forKey:@"Method"];
// Post Data
- [request appendPostData:[body dataUsingEncoding:NSUTF8StringEncoding]];
// Start execution
- [request startAsynchronous];
// Execution successful
- - (void)requestDidSuccess:(ASIFormDataRequest *)request
- {
// Obtain the header file
- NSDictionary *headers = [request responseHeaders];
// Obtain the http protocol Execution Code
- NSLog(@"Code:%d",[request responseStatusCode]);
- if ([delegaterespondsToSelector:@selector(OARequestSuccessed:withResponse:WithData:withHeaders:)])
- {
// Select the operating architecture to be delegated)
- [delegate OARequestSuccessed:method withResponse:[request responseString]WithData:[request responseData] withHeaders:headers];
- }
// Clear
- if (request)
- {
- [request release];
- }
// Disable the network
- [UIApplication sharedApplication].networkActivityIndicatorVisible = NO;
- }
// Execution failed
- - (void)requestDidFailed:(ASIFormDataRequest *)request{
// Obtain the User-Defined content
- NSString *method = [request.userInfo objectForKey:@"Method"];
Summary:IPhoneApplicationASIFormDataRequestPOST OperationArchitectureThe content of the design has been introduced. I hope this article will help you!