//
// ViewController.m
// afnnetworkingschfuxi
//
// Created by tianshangrenjian on 15/6/30.
// Copyright (c) 2015年 tianshangrenjian. All rights reserved.
//
#import "ViewController.h"
#import "AFNetworking.h"
@interface ViewController ()
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
}
- (void)methodPost
{
AFHTTPRequestOperationManager *mgr=[AFHTTPRequestOperationManager manager];
NSMutableDictionary *dict=[NSMutableDictionary dictionary];
dict[@"username"]=@"wyzc";
dict[@"pwd"]=@"wyzc";
mgr.responseSerializer=[AFHTTPResponseSerializer serializer];
[mgr POST:@"http://192.168.43.250:8080/WYServer/login" parameters:dict success:^(AFHTTPRequestOperation *operation, id responseObject) {
if (dict[@"error"]) {
NSLog(@"%@",dict[@"error"]);
} else {
NSLog(@"ok");
}
//id nsxmlparser
} failure:^(AFHTTPRequestOperation *operation, NSError *error) {
}];
}
- (void)methodGET
{
AFHTTPRequestOperationManager *mgr=[AFHTTPRequestOperationManager manager];
NSMutableDictionary *dict=[NSMutableDictionary dictionary];
[mgr GET:@"http://192.168.43.250:8080/WYServer/login?username=wyzc&pwd=wyzc" parameters:dict success:^(AFHTTPRequestOperation * operation, id responseObject) {
if (dict[@"error"]) {
NSLog(@"%@",dict[@"error"]);
} else {
NSLog(@"ok");
}
} failure:^(AFHTTPRequestOperation * operation, NSError * error) {
}];
}
-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
NSURL *url=[NSURL URLWithString:@"http://192.168.43.250:8080/WYServer/login?username=wyzc&pwd=wyzc"];
NSURLRequest *request=[NSURLRequest requestWithURL:url];
[self methodGET];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
- (void)xx
{
NSURL *url=[NSURL URLWithString:@"http://192.168.43.250:8080/WYServer/login?username=wyzc&pwd=wyzc"];
NSURLRequest *request=[NSURLRequest requestWithURL:url];
}
@end