JSPatch
JSPatch copied to clipboard
JSPatch使用setValue_forKey修改BOOL型成员变量在32位iPhone上崩溃 必现
经过一番试验, 我最开始发现要修改BOOL类型私有变量要使用self.setValue_forKey("false", "_sliderViewHidden");才能生效,用self.setValue_forKey(false, "_sliderViewHidden");或者self.setValue_forKey(1, "_sliderViewHidden");都不行。也就是value部分要传入"true"或者"false"。但是后来我发现,在32bit上会崩溃,value部分必须是0或者1才行。为什么这点在JSPatch介绍上都没人提及?
self.setValue_forKey("false", "_sliderViewHidden"); 应该是错的
self.setValue_forKey(1, "_sliderViewHidden"); 才正确,你确定这样不行?
用bool 代替BOOL