NSMutableDictionary赋值野指针闪退
ZHDeveloper opened this issue · 3 comments
ZHDeveloper commented
Describe the bug
A clear and concise description of what the bug is.
NSMutableDictionary赋值野指针闪退
To Reproduce
Steps to reproduce the behavior:
NSMutableDictionary *dict = [NSMutableDictionary dictionary];
__unsafe_unretained UIView *testObj = [[UIView alloc] init];
NSLog(@"testObj 指针指向的地址:%p 指针本身的地址:%p", testObj, &testObj);
dict[@"8888"] = testObj;
Please complete the following information
- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Version [e.g. 22]
jezzmemo commented
正常使用API也有这种问题吧,这种问题不是JJException的范畴
ZHDeveloper commented
这种闪退能避免吗?
jezzmemo commented
OC技术上是可行的,大概原理,先要定位是哪里野指针了,然后将野指针的对象dealloc置换,不让它真正释放,到Swift就很难了