App crashing on setting TableHeaderView

SumitSumit USMember

In my TableViewController ViewDidLoad method I am loading a nib file and setting TableHeaderView. This code throws NsRangeException on setting TableHeaderView.

Looking at the stack trace I can see it's failing on HeightForRowAtIndexPath. The code doesnt even override this method, can any one suggest what could be the reasons why it's failing?

var nibObjects = NSBundle.MainBundle.LoadNib("LoginUpdatePasswordHeader", this, null);
_loginUpdateHeader = (UIView)Runtime.GetNSObject(nibObjects.ValueAt(0));

TableView.TableHeaderView = _loginUpdateHeader;

Objective-C exception thrown. Name: NSRangeException Reason: *** -[__NSArrayI objectAtIndex:]: index 1 beyond bounds [0 .. 0]
Native stack trace:
0 CoreFoundation 0x07918746 __exceptionPreprocess + 182
1 libobjc.A.dylib 0x07cefa97 objc_exception_throw + 44
2 CoreFoundation 0x077f9cb2 -[__NSArrayI objectAtIndex:] + 210
3 UIKit 0x06abedda -[UITableViewDataSource tableView:heightForRowAtIndexPath:] + 127
4 UIKit 0x0682f4c6 -[UITableViewController tableView:heightForRowAtIndexPath:] + 76
5 ??? 0x1b027774 0x0 + 453146484
6 ??? 0x1b0276b8 0x0 + 453146296
7 ??? 0x1b027278 0x0 + 453145208
8 ??? 0x1b027481 0x0 + 453145729
9 ACSFundRaisingIos 0x002b1e53 mono_jit_runtime_invoke + 707
10 ACSFundRaisingIos 0x00370c6f mono_runtime_invoke + 127
11 ACSFundRaisingIos 0x00450b64 xamarin_fpret_single_trampoline + 5284
12 UIKit 0x067b6ac6 __66-[UISectionRowData

Sign In or Register to comment.