Just modified your code a little. It looks like there was an issue with the parameters being sent and the URL path.
Also since you are already using AFNetworking to make your POST request, you can follow their docs and example on how to send a photo over here: http://cocoadocs.org/docsets/AFNetworking/2.0.1/
NSDictionary *parameters = @{@"api_user": @"username",
@"api_key": @"sdsfddf23423",
@"Test SendGrid":@"test",
@"from":@"noreply@gmail.com",
@"to":@"test@gmail.com",
@"text":@"Test SendGrid from iOS app"};
NSURL *url = [NSURL URLWithString:@"https://sendgrid.com/api/"];
AFHTTPClient *client = [[AFHTTPClient alloc] initWithBaseURL: url];
NSMutableURLRequest *request = [client requestWithMethod:@"POST" path:@"mail.send.json" parameters:parameters];
AFHTTPRequestOperation *operation = [[AFHTTPRequestOperation alloc] initWithRequest:request];
[operation setCompletionBlockWithSuccess:^(AFHTTPRequestOperation *operation, id responseObject)
{
NSDictionary *response = [NSJSONSerialization JSONObjectWithData:responseObject options:0 error:nil];
// DLog(@"Get latest product info response : %@", response);
NSLog(@"Success: %@", response);
} failure: ^(AFHTTPRequestOperation *operation, NSError *error) {
NSLog(@"%@",error);
}];
[operation start];
Update**
Created a Sendgrid-ios library to make it easier to send an email and photo attachment.
//create Email Object
gridmail *msg = [gridmail user:@"username" andPass:@"password"];
//set parameters
msg.to = @"foo@bar.com";
msg.subject = @"subject goes here";
msg.from = @"me@bar.com";
msg.text = @"hello world";
msg.html = @"<h1>hello world!</h1>";
//Image attachment
[msg attachImage:self.photo];
//Send email through Web API Transport
[msg sendWithWeb];