diff --git a/microsoft-cognitive-services/iOS.md b/microsoft-cognitive-services/iOS.md index a60bdca..cef5f2f 100755 --- a/microsoft-cognitive-services/iOS.md +++ b/microsoft-cognitive-services/iOS.md @@ -46,20 +46,13 @@ void OnTakePhotoPressed (object sender, EventArgs eventArgs) picker.SourceType = UIImagePickerControllerSourceType.Camera; picker.FinishedPickingMedia += async (o, e) => { - // Create a moderate quality version of the image - byte [] dataBytes; - using (NSData data = e.OriginalImage.AsJPEG (.5f)) { - dataBytes = new byte [data.Length]; - System.Runtime.InteropServices.Marshal.Copy (data.Bytes, dataBytes, 0, Convert.ToInt32 (data.Length)); - } - ThePhoto.Image = e.OriginalImage; DetailsText.Text = "Processing..."; ((UIImagePickerController)o).DismissViewController (true, null); // Create a stream, send it to MCS, and get back - using (MemoryStream stream = new MemoryStream (dataBytes)) { + using (var stream = e.OriginalImage.AsJPEG(.5f).AsStream()) { try { float happyValue = await SharedProject.Core.GetAverageHappinessScore (stream); DetailsText.Text = SharedProject.Core.GetHappinessMessage (happyValue);