Feedback MFMessageComposeViewController To edit the To field:

I have an application that uses the standard SMS functions provided by MFMessageComposeViewController . I have an array of recipients visible in the TO: field of the SMS dialog. The user has the option to remove or add new recipients. This is normal, but my application should know when the user will edit this TO: field, because I have to perform some other actions when the user fields of the recipient are changed. Is there a way to find out if the recipients field has been edited or not, after clicking the "Cancel" or "Send" button, click?

I have a method callback in my code:

 -(void)messageComposeViewController:(MFMessageComposeViewController *)controller didFinishWithResult:(MessageComposeResult)result 

This method has controller.recipients , but this array contains recipients before calling the message manager view.

+4
source share
2 answers

This is not possible with iOS 7. The only information provided by the delegate method is whether the user was canceled, a message was sent or a message was sent.

From the documentation :

This method is called when the user drops one of the buttons to reject the message composition interface. Your implementation of this method should reject the view controller and take any additional steps necessary to process the sending of the message. The result parameter allows you to find out if the user chose to cancel or send the message or if the message could not be sent.

0
source

To add to Enrico’s answer, this is not only impossible from the point of view of the public API, but also impossible to deceive, since iOS6 creates message and message view controllers that are different from your own and their view hierarchies are completely hidden for your application. Indeed, if you want to check the hierarchy of the message view, create a view of the view controller, you will notice that nothing of what is on the screen is actually present in the hierarchy. At the time of loading the remote view, the parameters set to the message view controller are passed to the remote view controller. However, this is a one-way operation, and the properties are not updated (or read) after loading the remote view.

This protects user privacy. This is the fundamental design of iOS. You must accept this and design your application accordingly.

0
source

Source: https://habr.com/ru/post/1434140/


All Articles