ios - PageViewController on Xamarin will not load child content -


i quite new mobile dev forgive me if of seems trivial. trying basic pageviewcontroller working in xamarin ios number of different sign controllers have, different stages of app signup. user fill in page one, click continue , taken step 2 , forth.

i used sample pageviewcontroller project github , got working on simulator fine. when try , use sign controllers, error

foundation.monotouchexception: objective-c exception thrown. name: nsunknownkeyexception reason: [ setvalue:forundefinedkey:]: class not key value coding-compliant key dateofbirthtext.

this parent view controller onload method

public override void viewdidload()         {             base.viewdidload();              _pageviewcontroller = storyboard.instantiateviewcontroller("signinpageviewcontroller") uipageviewcontroller;             _pageviewcontroller.datasource = new pageviewcontrollerdatasource(this, _userinput);              var startvc = viewcontrolleratindex(0);             var viewcontrollers = new[] {startvc};              _pageviewcontroller.setviewcontrollers(viewcontrollers, uipageviewcontrollernavigationdirection.forward, false, null);             _pageviewcontroller.view.frame = new cgrect(0, 0, view.frame.width, view.frame.size.height - 50);             addchildviewcontroller(_pageviewcontroller);             view.addsubview(_pageviewcontroller.view);             _pageviewcontroller.didmovetoparentviewcontroller(this);                     } 

it throws error on line

_pageviewcontroller.setviewcontrollers 

and designer code child controller tries loaded pageviewcontroller , throws error

{     [register ("signinviewcontrollerstageone")]     partial class signinviewcontrollerstageone     {         [outlet]         [generatedcode ("ios designer", "1.0")]         uitextfield dateofbirthtext { get; set; }          [outlet]         [generatedcode ("ios designer", "1.0")]         uitextfield nametext { get; set; }          [outlet]         [generatedcode ("ios designer", "1.0")]         uibutton nextstepbutton { get; set; }          [outlet]         [generatedcode ("ios designer", "1.0")]         uitextfield phonenumbertext { get; set; }          [outlet]         [generatedcode ("ios designer", "1.0")]         uilabel titlelabel { get; set; }          void releasedesigneroutlets ()         {             if (dateofbirthtext != null) {                 dateofbirthtext.dispose ();                 dateofbirthtext = null;             }             if (nametext != null) {                 nametext.dispose ();                 nametext = null;             }             if (nextstepbutton != null) {                 nextstepbutton.dispose ();                 nextstepbutton = null;             }             if (phonenumbertext != null) {                 phonenumbertext.dispose ();                 phonenumbertext = null;             }             if (titlelabel != null) {                 titlelabel.dispose ();                 titlelabel = null;             }         }     } } 

update: full stack trace

unhandled exception:

foundation.monotouchexception: objective-c exception thrown. name: nsunknownkeyexception reason: [ setvalue:forundefinedkey:]: class not key value coding-compliant key dateofbirthtext.

native stack trace:

0 corefoundation 0x00958494 __exceptionpreprocess + 180

1 libobjc.a.dylib 0x08fd3e02 objc_exception_throw + 50

2 corefoundation 0x009580b1 -[nsexception raise] + 17

3 foundation 0x014777f8 -[nsobject(nskeyvaluecoding) setvalue:forundefinedkey:] + 282

4 foundation 0x013d1e6a _nssetusingkeyvaluesetter + 115

5 foundation 0x013d1def -[nsobject(nskeyvaluecoding) setvalue:forkey:] + 295

6 uikit 0x0397b931 -[uiviewcontroller setvalue:forkey:] + 85

7 foundation 0x0140654b -[nsobject(nskeyvaluecoding) setvalue:forkeypath:] + 384

8 uikit 0x03bf8a62 -[uiruntimeoutletconnection connect] + 132

9 libobjc.a.dylib 0x08fe800c -[nsobject performselector:] + 62

10 corefoundation 0x00881131 -[nsarray makeobjectsperformselector:] + 273

11 uikit 0x03bf70fc -[uinib instantiatewithowner:options:] + 2102

12 uikit 0x03983380 -[uiviewcontroller _loadviewfromnibnamed:bundle:] + 429

13 uikit 0x03983db8 -[uiviewcontroller loadview] + 189

14 uikit 0x039841c4 -[uiviewcontroller loadviewifrequired] + 154

15 uikit 0x03984ab1 -[uiviewcontroller view] + 35

16 uikit 0x04038649 -[uipageviewcontroller _setviewcontrollers:withcurloftype:fromlocation:direction:animated:notifydelegate:completion:] + 2250

17 uikit 0x0403a76a -[uipageviewcontroller setviewcontrollers:direction:animated:completion:] + 309

18 ??? 0x1a6a07cc 0x0 + 443156428

19 ??? 0x1a69f6d0 0x0 + 443152080

20 ??? 0x18d3200f 0x0 + 416489487

21 ??? 0x18d29c1d 0x0 + 416455709

22 barpandaapp 0x001be859 mono_jit_runtime_invoke + 921

23 barpandaapp 0x0027d0ce mono_runtime_invoke + 142

24 barpandaapp 0x0035e225 xamarin_trampoline + 5605

25 uikit 0x0397fb72 -[uiviewcontroller _sendviewdidloadwithappearanceproxyobjecttaggingenabled] + 44

26 uikit 0x03984692 -[uiviewcontroller loadviewifrequired] + 1384

27 uikit 0x039d02bb -[uinavigationcontroller _layoutviewcontroller:] + 52

28 uikit 0x039d0b75 -[uinavigationcontroller _updatescrollviewfromviewcontroller:toviewcontroller:] + 421

29 uikit 0x039d0d1c -[uinavigationcontroller _starttransition:fromviewcontroller:toviewcontroller:] + 145

30 uikit 0x039d2118 -[uinavigationcontroller _startdeferredtransitionifneeded:] + 1038

31 uikit 0x039d339e -[uinavigationcontroller __viewwilllayoutsubviews] + 68

32 uikit 0x03bb84b7 -[uilayoutcontainerview layoutsubviews] + 252

33 uikit 0x038843d4 -[uiview(calayerdelegate) layoutsublayersoflayer:] + 810

34 libobjc.a.dylib 0x08fe8059 -[nsobject performselector:withobject:] + 70

35 quartzcore 0x0b607096 -[calayer layoutsublayers] + 144

36 quartzcore 0x0b5fa8b6 _zn2ca5layer16layout_if_neededepns_11transactione + 388

37 quartzcore 0x0b5fa71a _zn2ca5layer28layout_and_display_if_neededepns_11transactione + 26

38 quartzcore 0x0b5ecee7 _zn2ca7context18commit_transactionepns_11transactione + 317

39 quartzcore 0x0b621847 _zn2ca11transaction6commitev + 561

40 quartzcore 0x0b622108 _zn2ca11transaction17observer_callbackep19__cfrunloopobservermpv + 92

41 corefoundation 0x0086a75e cfrunloop_is_calling_out_to_an_observer_callback_function + 30

42 corefoundation 0x0086a6be __cfrunloopdoobservers + 398

43 corefoundation 0x0085f868 cfrunlooprunspecific + 504

44 corefoundation 0x0085f65b cfrunloopruninmode + 123

45 uikit 0x037ae2da -[uiapplication _run] + 540

46 uikit 0x037b3eb9 uiapplicationmain + 160

47 ??? 0x18d27144 0x0 + 416444740

48 ??? 0x18d26ef4 0x0 + 416444148

49 ??? 0x18d249a0 0x0 + 416434592

50 ??? 0x18d24620 0x0 + 416433696

51 ??? 0x18d24823 0x0 + 416434211

52 barpandaapp 0x001be859 mono_jit_runtime_invoke + 921

53 barpandaapp 0x0027d0ce mono_runtime_invoke + 142

54 barpandaapp 0x002822d1 mono_runtime_exec_main + 401

55 barpandaapp 0x00282095 mono_runtime_run_main + 645

56 barpandaapp 0x0013a3d5 mono_jit_exec + 213

57 barpandaapp 0x0036d73a xamarin_main + 2474

58 barpandaapp 0x0036e351 main + 65

59 libdyld.dylib 0x094ada25 start + 1

actually, don't think should use uipageviewcontroller implement sign progress.

but if need it, there sample wrote other, can check link it:

xamarin.ios implement pagecontroller images code

i suggest use uinavigationcontroller, can make need, there example:

this code appdelegate(override method "finishedlaunching"):

public override bool finishedlaunching (uiapplication application, nsdictionary launchoptions)     {         signupstepviewcontroller step1 = new signupstepviewcontroller (1, uicolor.red);         signupstepviewcontroller step2 = new signupstepviewcontroller (2, uicolor.green);         signupstepviewcontroller step3 = new signupstepviewcontroller (3, uicolor.blue);         step1.setnextcontroller(step2);         step2.setnextcontroller(step3);          uinavigationcontroller mynavigationcontroller = new uinavigationcontroller (step1);         this.window = new uiwindow (uiscreen.mainscreen.bounds);         this.window.rootviewcontroller = mynavigationcontroller;         this.window.makekeyandvisible ();         return true;     } 

this code signupstepviewcontroller:

public class signupstepviewcontroller : uiviewcontroller {     public signupstepviewcontroller (int index,uicolor color)     {         this.title = "step " + index;         this.view.backgroundcolor = color;     }      public void setnextcontroller(signupstepviewcontroller nextc)     {         uibarbuttonitem btncontinue = new uibarbuttonitem ("continue",uibarbuttonitemstyle.done, delegate {             this.navigationcontroller.pushviewcontroller(nextc,true);         });         this.navigationitem.setrightbarbuttonitem (btncontinue,true);     } } 

hope can you.

if still need help, leave message here, check latter.


Comments