JSPatch icon indicating copy to clipboard operation
JSPatch copied to clipboard

slf[methodName].bind is not a function. (In 'slf[methodName].bind(slf)', 'slf[methodName].bind' is undefined),

Open winterrain5 opened this issue 7 years ago • 4 comments

slf[methodName].bind is not a function. (In 'slf[methodName].bind(slf)', 'slf[methodName].bind' is undefined),

原以为是在调用block时没有将self替换为slf,但是检查了一遍是没问题的 看了下调用栈: stack: [email protected]:71:36 [email protected]:29:116 JSPatch.js:167:27 [native code] [email protected]:14:39 JSPatch.js:167:27 [native code] [email protected]:7:33 JSPatch.js:151:41'

是崩溃在创建tableView的代码中:

creatTableView: function() { var secondMenu = HSSecondBBMenu.alloc().initWithOrigin_andHeight({x: 0,y: 0}, 44); secondMenu.setTextColor(UIColor.blackColor()); secondMenu.selectDeafultIndexPath(); secondMenu.setDelegate(self); secondMenu.setDataSource(self); self.view().addSubview(secondMenu); var mainScreen = UIScreen.mainScreen().bounds(); self.setTableView(UITableView.alloc().initWithFrame_style({x: 0, y: 108, width: mainScreen.width(), height: mainScreen.height() - 108 - 64}, 0)); self.tableView().setBackgroundColor(UIColor.colorWithRed_green_blue_alpha(248 / 255, 248 / 255, 248 / 255, 0)); self.tableView().setDelegate(self); self.tableView().setDataSource(self); self.tableView().setTableFooterView(UIView.alloc().initWithFrame(CGRectZero)); self.view().addSubview(self.tableView()); }

但是不知道问题出在哪儿,烦请指教,谢谢

winterrain5 avatar Feb 20 '17 02:02 winterrain5

看不出来,把调用栈里的 viewDidLoad initData 都发来看看,以及指明是哪一行有问题

bang590 avatar Feb 20 '17 03:02 bang590

viewDidLoad: function() { self.super().viewDidLoad(); self.initData(); },

initData: function() { NSNotificationCenter.defaultCenter().addObserver_selector_name_object(self, "cityScreen2Action:", "cityScreen2", null); self.setEdgesForExtendedLayout(0); self.view().setBackgroundColor(UIColor.colorWithRed_green_blue_alpha(248 / 255, 248 / 255, 248 / 255, 0)); self.creatNavigationBar(); self.creatTableView(); // 创建tableView self.setupRefreshView(); self.loadAllTeamData(); self.setCityId("0"); self.setProvinceId("0"); self.setCountyId("0"); },

winterrain5 avatar Feb 20 '17 03:02 winterrain5

你断点JSPatch.js看看 slfmethodNameslf[methodName]分别是什么吧

bang590 avatar Feb 20 '17 06:02 bang590

问下你这个问题最终是怎么解决的

peter2022Begin avatar Dec 24 '20 05:12 peter2022Begin