我正在尝试在没有 pod 的情况下在我的项目中实施 Afnetworking,只需将文件复制粘贴到我的项目中,但它不起作用
I am trying to Implement Afnetworking in my project without pod just copy paste the files in my project but it is not working
在 3.0 Afnetworking 中,我正在复制 AFNetworking、UIKit+AFNetworking 并导入 AFNetworking.h 但出现错误
我想知道如何在没有pod的情况下实现Afnetworking
有人可以帮我解决这个问题吗...
AFHTTPRequestOperationManager * manager =[[AFHTTPRequestOperationManager alloc]init];
[manager POST:@"http://192.168.1.92/Abdul/Json/student.json" parameters:@"" success:^(AFHTTPRequestOperation *operation, id responseObject) {
NSLog(@"RESULT .. %@",responseObject);
} failure:^(AFHTTPRequestOperation *operation, NSError *error) {
NSLog(@"ERR .. %@",error);
}];
如果您使用最新版本的 afnetwork 3.x
NSURL *URL = [NSURL URLWithString:@"http://192.168.1.92/Abdul/Json/student.json"];
AFHTTPSessionManager *manager = [AFHTTPSessionManager manager];
[manager POST:URL.absoluteString parameters:nil progress:nil success:^(NSURLSessionTask *task, id responseObject) {
NSLog(@"JSON: %@", responseObject);
} failure:^(NSURLSessionTask *operation, NSError *error) {
NSLog(@"Error: %@", error);
}];
如果您使用 afnetwork 的最旧版本 2.x
AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];
[manager POST:@"http://192.168.1.92/Abdul/Json/student.json" parameters:nil success:^(AFHTTPRequestOperation *operation, id responseObject) {
NSLog(@"JSON: %@", responseObject);
} failure:^(AFHTTPRequestOperation *operation, NSError *error) {
NSLog(@"Error: %@", error);
}];
备注
检查一次是否导入了头文件
#import <AFNetworking/AFHTTPRequestOperationManager.h> // or #import "AFHTTPRequestOperationManager.h"
在 3.0 Afnetworking 中,我正在复制 AFNetworking、UIKit+AFNetworking 并导入 AFNetworking.h 但出现错误
我想知道如何在没有pod的情况下实现Afnetworking
有人可以帮我解决这个问题吗...
AFHTTPRequestOperationManager * manager =[[AFHTTPRequestOperationManager alloc]init];
[manager POST:@"http://192.168.1.92/Abdul/Json/student.json" parameters:@"" success:^(AFHTTPRequestOperation *operation, id responseObject) {
NSLog(@"RESULT .. %@",responseObject);
} failure:^(AFHTTPRequestOperation *operation, NSError *error) {
NSLog(@"ERR .. %@",error);
}];
如果您使用最新版本的 afnetwork 3.x
NSURL *URL = [NSURL URLWithString:@"http://192.168.1.92/Abdul/Json/student.json"];
AFHTTPSessionManager *manager = [AFHTTPSessionManager manager];
[manager POST:URL.absoluteString parameters:nil progress:nil success:^(NSURLSessionTask *task, id responseObject) {
NSLog(@"JSON: %@", responseObject);
} failure:^(NSURLSessionTask *operation, NSError *error) {
NSLog(@"Error: %@", error);
}];
如果您使用 afnetwork 的最旧版本 2.x
AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];
[manager POST:@"http://192.168.1.92/Abdul/Json/student.json" parameters:nil success:^(AFHTTPRequestOperation *operation, id responseObject) {
NSLog(@"JSON: %@", responseObject);
} failure:^(AFHTTPRequestOperation *operation, NSError *error) {
NSLog(@"Error: %@", error);
}];
备注
检查一次是否导入了头文件
#import <AFNetworking/AFHTTPRequestOperationManager.h> // or #import "AFHTTPRequestOperationManager.h"