It seems that I have accidentally deleted a line of code. Looking through past commits I found my problem. I deleted the Content-Type line.
NSMutableData *body = [NSMutableData data];
[body appendData:[[NSString stringWithFormat:@"\r\n--%@\r\n",boundary] dataUsingEncoding:NSUTF8StringEncoding]];
[body appendData:[@"Content-Type: application/octet-stream\r\n\r\n" dataUsingEncoding:NSUTF8StringEncoding]];// Here was my problem
[body appendData:[[NSString stringWithFormat:@"Content-Disposition: form-data; name=\"uploadedFile\"; filename=\"%@.jpg\"\r\n", deviceId] dataUsingEncoding:NSUTF8StringEncoding]];
[body appendData:[NSData dataWithData:imageData]];
[body appendData:[[NSString stringWithFormat:@"\r\n--%@\r\n",boundary] dataUsingEncoding:NSUTF8StringEncoding]];