Why the image size is always Invalid? RRS feed

  • Question

  • I try to use the face detection API using swift. Here comes the error:

    SUCCESS: {     code = InvalidImageSize;     message = "Image size is too small or too big."; })

    I am sure the image size is ok, but it always tells its wrong, maybe the body is empty. I can't find an example of how to write the body.

    My body code:

    let imgData:NSData = UIImageJPEGRepresentation(photoImageView.image!, 1)!;

    let mutabledata:NSMutableData = NSMutableData(data: imgData)

    mutableURLRequest.HTTPBody = "\(mutabledata)".dataUsingEncoding(NSUTF8StringEncoding)

    Any suitable example will help a lot. Thanks!

    Sunday, November 22, 2015 9:05 AM