bang590 / JSPatch

JSPatch bridge Objective-C and Javascript using the Objective-C runtime. You can call any Objective-C class and method in JavaScript by just including a small engine. JSPatch is generally used to hotfix iOS App.
MIT License
11.36k stars 2.24k forks source link

替换 ViewdidLoad 崩溃 #129

Closed lubaoyilang closed 8 years ago

lubaoyilang commented 8 years ago

require('UIColor,UIAlertView,UIView'); defineClass('UFQLifeViewController', { viewDidLoad: function() { self.super().viewDidLoad(); self.view().setBackgroundColor(UIColor.whiteColor()); self.setTitle("111"); self.initValue(); self.initView(); self.loadData();

},

});

调出崩溃,问题出在哪里呢?

ghost commented 8 years ago

请多提供一些信息,比如log,崩溃的位置等。

lubaoyilang commented 8 years ago

崩溃在汇编信息这里,obj_release 这里 我这个Controller 是继承其他Controller 来的。 我做了尝试,新建一个工程,然后搞了多个Controller继承关系,用js来调用Viewdidload,没有问题 然后回到我们项目,调用这个崩溃的Controller其他的方法,比如一个 testFun(),也不会发生崩溃 但是只要调用 Controller 的 ViewdidLoad 或者 ViewdidApper 这些方法,就会崩溃。 可以帮忙一起来分析一下嘛?定位一下问题。

继承关系 UIViewController -> BaseViewController ->UFQLifeViewController

我基于 BaseViewController 来调用 也不会发生问题,但是只要用最顶层Controller 就会发生问题。 require('UIColor,UIAlertView,UIView'); defineClass('BaseViewController', { viewDidLoad: function() { self.super().viewDidLoad(); self.view().setBackgroundColor(UIColor.whiteColor()); self.setTitle("111"); self.initValue(); self.initView(); self.loadData();

},

});

bang590 commented 8 years ago

有没有用 Aspect ?

lubaoyilang commented 8 years ago

111

lubaoyilang commented 8 years ago

没有。。。Aspect

bang590 commented 8 years ago

可能是某些SDK里用了Aspects?可以先去掉 JSPatch,在你说的 ViewdidApper 方法上断点看看堆栈