c# - MonoTouch - Could not load NIB in bundle: 'NSBundle' -
getting error saying not load nib in bundle: nsbundle when sub classed pageviewcontroller attempts load/display.
(see attached file screen shot)
i have tried deleting viewcontrollers , associated code , recreating them again scratch.
i have shut down iphone simulator , xamarin , restarted them in hope issue related to: could not load nib in bundle - inspiration needed no avail.
can point out possibly going wrong please?
note: onboardinghome , onboardingpage viewcontrollers created within ios designer , sub classes created each.
vc_onboardinghome.cs
using foundation; using system; using system.codedom.compiler; using uikit; namespace performance { partial class vc_onboardinghome : uiviewcontroller { private uipageviewcontroller pageviewcontroller; private int pagecount = 3; public vc_onboardinghome (intptr handle) : base (handle) { } public override void viewdidload () { base.viewdidload (); vc_onboardpage firstpage = new vc_onboardpage(); firstpage.pageindex = 0; pageviewcontroller = new uipageviewcontroller ( uipageviewcontrollertransitionstyle.pagecurl, uipageviewcontrollernavigationorientation.horizontal, uipageviewcontrollerspinelocation.min); this.pageviewcontroller.setviewcontrollers ( new uiviewcontroller[] { firstpage }, uipageviewcontrollernavigationdirection.forward, false, s => { } ); this.pageviewcontroller.getnextviewcontroller = this.getnextviewcontroller; //this.pageviewcontroller.getnextviewcontroller(this.pageviewcontroller, this); this.pageviewcontroller.getpreviousviewcontroller = this.getpreviousviewcontroller; //this.pageviewcontroller.getnextviewcontroller(this.pageviewcontroller, this); this.pageviewcontroller.view.frame = this.view.bounds; //this.view.addsubview(this.pageviewcontroller.view); this.view.addsubview (pageviewcontroller.view); } private uiviewcontroller getnextviewcontroller(uipageviewcontroller pagecontroller, uiviewcontroller referenceviewcontroller) { vc_onboardpage currentpagecontroller = referenceviewcontroller vc_onboardpage; if (currentpagecontroller.pageindex >= (this.pagecount - 1)){ return null; }else{ int nextpageindex = currentpagecontroller.pageindex + 1; vc_onboardpage vc_onboardpage = new vc_onboardpage (); vc_onboardpage.pageindex = nextpageindex; return vc_onboardpage; } } private uiviewcontroller getpreviousviewcontroller(uipageviewcontroller pagecontroller, uiviewcontroller referenceviewcontroller) { vc_onboardpage currentpagecontroller = referenceviewcontroller vc_onboardpage; if (currentpagecontroller.pageindex <= 0){ return null; }else{ int previouspageindex = currentpagecontroller.pageindex - 1; vc_onboardpage vc_onboardpage = new vc_onboardpage (); vc_onboardpage.pageindex = previouspageindex; return vc_onboardpage; } } public override void didreceivememorywarning () { // releases view if doesn't have superview. base.didreceivememorywarning (); // release cached data, images, etc aren't in use. } } }
vc_onboardpage.cs
using foundation; using system; using system.codedom.compiler; using uikit; namespace performance { partial class vc_onboardpage : uiviewcontroller { private int pageindex; public int pageindex { get; set; } // public vc_onboardpage (intptr handle) : base (handle) public vc_onboardpage () : base("vc_onboardpage", null) { console.writeline ("page -> _constructor"); // this.pageindex = this.; } public override void didreceivememorywarning () { // releases view if doesn't have superview. base.didreceivememorywarning (); // release cached data, images, etc aren't in use. } public override void viewdidload () { base.viewdidload (); lbl_headertxt.text = "label here"; console.writeline ("page -> viewdidload"); // perform additional setup after loading view, typically nib. // this.imgview.image = uiimage.fromfile(string.format("images/{0}.jpg", this.pageindex + 1)); lbl_headertxt.text = string.format("page {0}", this.pageindex + 1); } public override void viewdidappear (bool animated) { base.viewdidappear (animated); console.writeline ("page -> viewdidappear"); } } }
stacktrace
2015-07-27 14:13:07.663 performance[8146:1518846] page -> _constructor 2015-07-27 14:13:11.291 performance[8146:1518846] unhandled managed exception: objective-c exception thrown. name: nsinternalinconsistencyexception reason: not load nib in bundle: 'nsbundle </users/johncogan/library/developer/coresimulator/devices/116bf4aa-5d28-4b3a-91f2-b9fa4fbfdee8/data/containers/bundle/application/5bd82ba5-65ee-496f-8bce-887fec5522ad/performance.app> (loaded)' name 'vc_onboardpage' (foundation.monotouchexception) @ objcruntime.runtime.thrownsexception (intptr ns_exception) [0x00000] in /users/builder/data/lanes/1962/8b265d64/source/maccore/src/objcruntime/runtime.cs:167 @ objcruntime.runtime.throw_ns_exception (intptr exc) [0x00000] in /users/builder/data/lanes/1962/8b265d64/source/maccore/runtime/delegates.generated.cs:100 @ (wrapper native-to-managed) objcruntime.runtime:throw_ns_exception (intptr) @ (wrapper managed-to-native) objcruntime.messaging:void_objc_msgsend_intptr_int_bool_intptr (intptr,intptr,intptr,int,bool,intptr) @ uikit.uipageviewcontroller.setviewcontrollers (uikit.uiviewcontroller[] viewcontrollers, uipageviewcontrollernavigationdirection direction, boolean animated, uikit.uicompletionhandler completionhandler) [0x0005f] in /users/builder/data/lanes/1962/8b265d64/source/maccore/src/build/ios/native/uikit/uipageviewcontroller.g.cs:148 @ performance.vc_onboardinghome.viewdidload () [0x00055] in /users/johncogan/development/xamarin/performance_shared/performance/vc_onboardinghome.cs:28 @ (wrapper managed-to-native) uikit.uiapplication:uiapplicationmain (int,string[],intptr,intptr) @ uikit.uiapplication.main (system.string[] args, intptr principal, intptr delegate) [0x00005] in /users/builder/data/lanes/1962/8b265d64/source/maccore/src/uikit/uiapplication.cs:63 @ uikit.uiapplication.main (system.string[] args, system.string principalclassname, system.string delegateclassname) [0x00038] in /users/builder/data/lanes/1962/8b265d64/source/maccore/src/uikit/uiapplication.cs:47 @ performance.application.main (system.string[] args) [0x00008] in /users/johncogan/development/xamarin/performance_shared/performance/main.cs:14 2015-07-27 14:13:11.292 performance[8146:1518846] critical: stacktrace:
i assume using storyboard , editing in xamarin's built-in ios designer.
how did add viewcontrollers project? in experience, 1 of fail-safest ways in xamarin's ios designer specify class name in properties of view controller.
this generate new vc-class this:
partial class vc_test : uiview { public vc_test (intptr handle) : base (handle) { } }
note constructor invokes base constructor intptr argument. contrast constructor, invokes string argument:
// public vc_onboardpage (intptr handle) : base (handle) public vc_onboardpage () : base("vc_onboardpage", null)
when last checked, string arguments valid when using nibs/xibs, not used ios designer. suspect may source of problem, string "vc_onboardpage" mentioned in error message.
i'd try , following:
- rename view's 'class'-property in ios designer new name.
- clean , rebuild solution
feel free comment.
Comments
Post a Comment