A follow on from the saga of previous posts -
After an upgrade the people picker code ceased to function and was
undebuggable
AS a couple of people pointed out the problem was likely to be in the new
way 4.1 handles the controller and its dismissal.
I've reverted to md 2.6 and mono 4.04 and recovered the position but having
played a bit with the new xcode and md 2.8 and being assured that the
newmonotouch is handling dismissal of controllers correctly .... then I'd
like my code to do it 'correctly' also
So could ANYONE say how this code should be changed so that it does not
cause a crash under 4.1
Interestingly it only crashes, the moment you introduce the two PPVC.Cancel
and PPVC.SelectPerson methods - even if these delegates have no code in them
they cause a null reference exception. Am I right therefore in assuming this
means it has nothing to do with dismissmodalviewcontroller?
If you rem them out completely there is no crash but of course one cannot
exit the modal picker.
Finally what is the right way of achieving this in mono 4.1????
public partial class AppDelegate : UIApplicationDelegate
{
// assume this is what is meant by declaring the peoplepicker at class
level?????
protected ABPeoplePickerNavigationController ppvc=new
ABPeoplePickerNavigationController();
public override bool FinishedLaunching (UIApplication app,
NSDictionary options)
{
window.AddSubview (navcontrol.View);
window.MakeKeyAndVisible ();
button.TouchUpInside +=delegate{
navcontrol.PresentModalViewController(ppvc,true);
};
// if one comments out the next two delegates code does
not cause exception
// but even if delegates are left in with blank code
they cause null object exception under mono 4.1 >
// so it appears nothing to do with
dismissingmodalviewcontroller
ppvc.Cancelled+=delegate(object sender,EventArgs e)
{
navcontrol.DismissModalViewControllerAnimated(true);
};
ppvc.SelectPerson+=delegate (object
sender,ABPeoplePickerSelectPersonEventArgs args1)
{
if (!args1.Continue)
{ // do something;
navcontrol.DismissModalViewControllerAnimated(true);}
};
return true;
}
Once again thanks in advance to those kind souls prepared to help
John Murray
_______________________________________________
MonoTouch mailing list
[email protected]
http://lists.ximian.com/mailman/listinfo/monotouch