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
