JJException
JJException copied to clipboard
NSMutableDictionary赋值野指针闪退
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;
![截屏2022-07-25 下午4 01 07](https://user-images.githubusercontent.com/12929278/180728192-68ecd1ae-79f0-4f89-855a-21d1f94a4668.png)
Please complete the following information
- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Version [e.g. 22]
正常使用API也有这种问题吧,这种问题不是JJException的范畴
这种闪退能避免吗?
OC技术上是可行的,大概原理,先要定位是哪里野指针了,然后将野指针的对象dealloc置换,不让它真正释放,到Swift就很难了