NSMutableDictionary *inputData = [NSMutableDictionary dictionaryWithObjectsAndKeys:[self.usertext text], @"username", [self.passwordtext text], @"password", nil];
NSData *jsonData = [NSJSONSerialization dataWithJSONObject:inputData options:0 error:nil];
NSString *json = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];
NSDictionary *dict = @{@"body":json};
NSLog(@"JSOND: %@", dict);
NSLog(@"JSON: %@", json);
// Create a Request with the given URL
AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];
manager.responseSerializer = [AFJSONResponseSerializer serializer];
[manager.requestSerializer setValue:@"application/json" forHTTPHeaderField:@"Accept"];
[manager.requestSerializer setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
[manager.requestSerializer setValue:@"bearer null" forHTTPHeaderField:@"Authorization"];
[manager POST:@"http://ift.tt/1OSE5TF" parameters:dict success:^
(AFHTTPRequestOperation *operation, id responseObject)
{
NSLog(@"operation: %@", operation);
NSLog(@"Response: %@", responseObject);
}
failure:^(AFHTTPRequestOperation *operation, NSError *error) {
NSString *myString = [[NSString alloc] initWithData:operation.request.HTTPBody encoding:NSUTF8StringEncoding];
NSLog(@"Error: %@", myString);
}];
mardi 4 août 2015
this is my i am gitting error why any one tell me they can give me error
Inscription à :
Publier les commentaires (Atom)
Aucun commentaire:
Enregistrer un commentaire