想要使用带有 AFNetworking 的 json 从 iOS 传递 NSArray 或 NSDitory 到 PHP WebServer
NSDictionary *courseList = ........;
NSString* name = @"UserName";
NSString* password = @"Password";
NSDictionary *parameters = [NSDictionary dictionaryWithObjectsAndKeys:
name, @"UserName",
password, @"Password",
courseList, @"courseList",
nil];
NSURL *baseURL = [NSURL URLWithString:[NSString stringWithFormat:SERVER_URL]];
AFHTTPClient *client = [[AFHTTPClient alloc] initWithBaseURL:baseURL];
[client registerHTTPOperationClass:[AFJSONRequestOperation class]];
[client setDefaultHeader:@"Accept" value:@"application/json"];
[client setDefaultHeader:@"Accept-Charset" value:@"utf-8"];
[client postPath:URL
parameters:parameters
success:^(AFHTTPRequestOperation *operation, id json) {
}
failure:^(AFHTTPRequestOperation *operation, NSError *error) {
}
];