Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 91519

Issue opening a MFMessageComposeViewController on any option click in UIALertView in iOS platform

$
0
0

I have a requirements to show 3 options in an alert say Call / Text/ Cancel for iOS. As displayAlert cannot be used for 3 options I have created platform specific tweak and using UIAlertView in iOS. I have created an interface to show UIAlertView for the same and implementing in iOS project.

However now when user selects Text option in alertView I need to launch MFMessageComposeViewController and I am using below code in my iOS project.
However UIApplication.SharedApplication.KeyWindow.RootViewController is returned as UIAlertView due to which MessageComposer is never shown.
I tried using InvokeOnMainThread , however still the issue is not resolved.

How to resolve this ?

if (userMobileNumberList != null && userMobileNumberList.Count > 0 && CanSend) {
var smsController = new MFMessageComposeViewController () {
Recipients = userMobileNumberList.ToArray ()
};

                smsController.Finished += (s, e) => 

                    ((MFMessageComposeViewController)s).DismissViewController (true, () => {
                    });

               **** UIApplication.SharedApplication.KeyWindow.RootViewController.PresentViewController (smsController, true, null);****
            }

Viewing all articles
Browse latest Browse all 91519

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>