2

In my App the User needs to type in some Address Information. I provide an Addressbook Button for that since Version 1.0. That worked fine in my previous tests, but now I get a SIGSEGV when I try to set my UITextField.Text property. This error occurs everytime when I try to Pick an Address from the PeoplePicker in MonoTouches Debug mode, when I try that on my iPhone the eror occurs randomly between setting the TextFields and pushing the next ViewController. Is There anything wrong in my Code or is it a bug?

        //AB Button Event
        addressBook.TouchUpInside += delegate {
            //Create new Picker
            ABPeoplePickerNavigationController PP = new ABPeoplePickerNavigationController();
            //Cancel Event
            PP.Cancelled += delegate {
                NavigationController.DismissViewController(true, null);
            };
            //Select Event
            PP.SelectPerson += delegate(object sender, ABPeoplePickerSelectPersonEventArgs e) {
                //Detailed Person View
                ABPersonViewController pv = new ABPersonViewController();
                //Action when clicked on a Property
                pv.PerformDefaultAction += delegate(object person, ABPersonViewPerformDefaultActionEventArgs ev) {
                    //If the Property was an Address
                    if(ev.Property.ToString() == "Address"){
                        string lands = "", orts = "", plzs = "";
                        try{
                            //Read the Detailed Address Data from the clicked property
                            ABMultiValue<PersonAddress> addresses = ev.Person.GetAllAddresses();
                            PersonAddress[] values = addresses.GetValues();
                            lands = values[ev.Identifier.Value].Country.ToString();
                            orts = values[ev.Identifier.Value].City.ToString();
                            plzs = values[ev.Identifier.Value].Zip.ToString();
                        }catch{
                            Console.WriteLine("Fehlerhafte Addresse");
                        }
                        //Set the Textfield with the new information
                        //iPhone Simulator in Debugmode crashes here everytime
                        land.Text = lands;
                        ort.Text = orts;
                        plz.Text = plzs;
                        //Close the Module
                        NavigationController.DismissViewController(true, null);
                    }
                };
                //Set selected Person for the person View
                pv.DisplayedPerson = e.Person;
                //Open Person View with navigation from the PeoplePicker Controller
                PP.PushViewController(pv, true);
            };
            //Open PeoplePicker Controller Module
            NavigationController.PresentViewController(PP, true, null);
        };

Thanks in advance!

SYNT4X
  • 210
  • 2
  • 15
  • Could you state which version of MonoTouch you are using ? 6.0.5 was released (to beta) a few hours ago and has a fix for a similar issue. Could you try it ? – poupou Oct 29 '12 at 19:53
  • Great :-) I added this as an answer so it can be useful to other people looking for the same issue. Please mark the question as answered to help them too. Thanks for your confirmation. – poupou Oct 29 '12 at 21:33

1 Answers1

2

The just released MonoTouch 6.0.5 has a fix for a similar issue.

poupou
  • 43,413
  • 6
  • 77
  • 174