Created
May 30, 2014 16:34
-
-
Save dannycabrera/0f22f7b8abcfb608560a to your computer and use it in GitHub Desktop.
Send MMS with Image Attachment using Xamarin.iOS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Source: http://davidsonblake.wordpress.com/2014/05/29/send-mms-with-image-attachment-using-xamarin-ios/ | |
void SendMMS () | |
{ //Init View Controller | |
var messageController = new MFMessageComposeViewController (); | |
//Verify app can send text message | |
if(MFMessageComposeViewController.CanSendText) | |
{ | |
messageController.Body = "Here's an image for u 2 n joy."; | |
//Add attachment as NSData, and set the uti | |
messageController.AddAttachment (UIImage.FromFile ("chimp.png").AsPNG (); , "kUTTypePNG", "image.png"); | |
messageController.Finished += (sender, e) => (DismissViewController (true, null)); | |
this.PresentViewController (messageController, true, () => ViewModel.IsBusy = false); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment