我需要向服务器发送电子邮件ID,以使用AFNetworking重置此电子邮件地址。
SSAFRequest *afm= [[SSAFRequest alloc]init];
NSDictionary *params = @{@"email": @"a@b.com"};
[afm AfRequest_POST_Params:urlWithQuerystring urlWithQuerystring:urlWithQuerystring params:params :^(id JSON, NSError *error) {
if(JSON!=Nil && ![JSON isEqual:[[NSNull alloc]init]]) {
}];
这是我的AFNetworking代码:
-(void)AfRequest_POST_Params:(NSString *)baseUrl urlWithQuerystring:(NSString *)urlstring params:(NSDictionary *)parameters:(void (^)(id result, NSError *error))block {
NSLog(@"AfRequest_POST_Params ----%@ %@",baseUrl,urlstring);
AFHTTPRequestOperationManager *manager = [[AFHTTPRequestOperationManager manager]initWithBaseURL:[NSURL URLWithString:baseUrl]];
manager.responseSerializer = [AFJSONResponseSerializer serializerWithReadingOptions:NSJSONReadingAllowFragments];
[manager POST:baseUrl parameters:parameters
success:^(AFHTTPRequestOperation *operation, id responseObject){
NSLog(@"****Success****");
block(responseObject,nil);
}
failure:^(AFHTTPRequestOperation *operation, NSError *error) {
NSLog(@"Error: %@", error.localizedDescription);
block(nil,error);
}
];
}
但我不知道我的代码中缺少什么。这是我得到的错误:
<0x16d95210 SSLoginViewController.m:(821)> Error Domain=NSCocoaErrorDomain Code=3840 "The operation couldn’t be completed. (Cocoa error 3840.)" (Invalid value around character 0.) UserInfo=0x16ec5cd0 {NSDebugDescription=Invalid value around character 0.}
请在此建议我,提前致谢。