Jeff That sounds as if it's on the money
Now apologies for being a dumbo - I frequently can't get beyond the autism of functional programming - How exactly do I 'hold a reference to ppvc' elsewhere ? This sounds a bit like Jason' ssuggestion of declaring ppvc at class level I mean in really painfully idiot terms - do I declare it somewhere at the start of the code - make it static or something ? Presumably when I 'dismissmodalcontroller' - thinking I'm just knocking a form off the stack then it is destroyed then the code goes looking for it in case it is called up again and it's not there? Is that it ? (y'see I need it explained in two year old terms) Is there any way other than using 'dismissmodalcontroller' - it's being called from a view controller and that doesn't have a popview method //// update - while I've been writing this I've commented out the line DismissModalViewControllerAimated and - no change - still falls over with null referenceobject So obviously this doesn't work at all - it's not the dismissing the ppvc that is causing the problem The code is word for word as per examples in "iPhone Programming with MonoTouch and.Net/C#" If things are now so different in 4.1 I need a new example of how to call up the people/contacts Thanks for your help anyway - helps me feel less panicky J - John Murray From: Jeff Stedfast [mailto:[email protected]] Sent: 18 August 2011 15:54 To: [email protected] Cc: Jason Awbrey; [email protected] Subject: Re: [MonoTouch] people picker problem after upgrading to touch 4 and MD2.8Alpha Hi John, DismissModalViewController() now clears the parent's ModalViewController property, which, if that is the only reference that still exists for your ppvc, will be lost (cleared to null). What you need to do is make sure you hold a reference to that object elsewhere. This is one of the fixes in the 4.1 beta branch which is needed to more accurately reflect the state of the underlying objects. The reason it happened to work because is because we wrongly kept the ModalViewController property cached which prevented expected garbage collection when the modal view was dismissed. For more information, see http://bugzilla.xamarin.com/show_bug.cgi?id=172 Hope that helps, Jeff On Thu, Aug 18, 2011 at 8:46 AM, John Murray <[email protected]> wrote: Doesn't make the slightest difference - still get null reference exception Also doens't explain why it worked in previous version of MD and touch Also I have tried loading several examples from the Wally B etc book which worked fine before - I simply get SIGSEGV errors trying to run them Thanks anyway Yours in further desperation From: Jason Awbrey [mailto:[email protected]] Sent: 18 August 2011 13:34 To: [email protected] Cc: [email protected] Subject: Re: [MonoTouch] people picker problem after upgrading to touch 4 and MD2.8Alpha the first thing I'd try is to move the declaration "var ppvc" from your local scope and declare it at the class level instead. On Thu, Aug 18, 2011 at 7:02 AM, John Murray <[email protected]> wrote: I downloaded monotouch 4 and 2.8 of MD this morning after a prompt from MD My app has a view which requires user to enter name and address info It has a button which allows user to pick from the contacts list Code lifted straight from Wally B's book It's worked fine until now - I mean last night fine - this morning after upgrade No It is undebuggable - cannot even get to a break point simply drops out with green line at UIApplication.Main(args) As I say I've not changed code overnight. The trace shows it failing on monotouch.utils.backingField.get In developer/monotouch/source/monotouch/src/utils/backingField.cs line 47 I'd be the first to admit my code is not exactly expert - I do hope this is a fault in the new version rather than I have to go to college for 10 years to discover how to do it properly as every new developer tool/evolution seems to get more complicatedJ It seem simple enough - I cant imagine what I am doing wrong and why it only comes out now after the upgrade A button calls - paxViewController.PresentModalViewController(ppvc,true) ; the ppvc is declared like this var ppvc = new ABPeoplePickerNavigationController(); and then it has a few override methods e.g. ppvc.SelectPerson+=delegate(object sender,ABPeoplePickerSelectPersonEventArgs e) { //do something //dismiss modal paxViewController.DismissModalViewControllerAnimated(true); }; And that's all there is to it - as I say it doesn't even get to these lines - on touching the contact (any contact) to select it drops out with nullreference exception And no clue as to what is causing it are there changes in monotouch4 which mean I have to do things differently? Desperate for help here - completely out of my depth. Tia John Murray _______________________________________________ MonoTouch mailing list [email protected] http://lists.ximian.com/mailman/listinfo/monotouch _______________________________________________ MonoTouch mailing list [email protected] http://lists.ximian.com/mailman/listinfo/monotouch
_______________________________________________ MonoTouch mailing list [email protected] http://lists.ximian.com/mailman/listinfo/monotouch
