+ (BOOL) isSendEventToDealloctingObject:(UIEvent *)event {
if (event.type == UIEventTypeTouches) {
for (UITouch *touch in event.allTouches) {
NSString *windowName = NSStringFromClass([touch.window class]);
if ([windowName isEqualToString:@"UIRemoteKeyboardWindow"]) {
UIView* view = touch.view;
UIResponder *arg2 = view.nextResponder;
NSString* responderClassName = NSStringFromClass([arg2 class]);
if ([responderClassName isEqualToString:@"_UIRemoteInputViewController"]) {
bool isDeallocating = false;
// Use 'performSelector' when u are develop a App-Store App.
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Warc-performSelector-leaks"
SEL sel = NSSelectorFromString(@"_isDeallocating");
isDeallocating = [arg2 respondsToSelector:sel] && [arg2 performSelector:sel];
#pragma clang diagnostic pop
if (isDeallocating) {
NSLog(@"UIWindow - BingGo a deallocating object ...");
return true;
}
}
}
}
}
return false;
}
Post
Replies
Boosts
Views
Activity
Look at this,hope it helps you - https://developer.apple.com/forums/thread/711820?answerId=745458022#745458022
Using a UITouch category to filter the
deallocating object. - (BOOL)_wantsForwardingFromResponder: toNextResponder: withEvent:
Github: https://github.com/SnowGirls/Objc-Deallocating . Just Drag the ObjcUtil.h/m and UITouch+FixCrashOnInputKeyboard.h/m into your Xcode project.
Solution: https://github.com/SnowGirls/Objc-Deallocating
Using a UITouch Category to Override this method and check the Deallocating object. - (BOOL)_wantsForwardingFromResponder: toNextResponder: withEvent:
How to use? Just drag the ObjcUtil.h/m and UITouch+FixCrashOnInputKeyboard.h/m into your Xcode project, and done.
Use dsc_extractor to extract the Foundation.framework out from the dyld_shared_cache_arm64, that pull down from iOS 15.6 (on $HOME/Library/Developer/Xcode/iOS\ DeviceSupport/15.6/Symbols/System/Library/Caches/com.apple.dyld/dyld_shared_cache_arm64e).
Drag it to Foundation.framework/Foundation to IDA64.
So, the reason is obvious, the +[NSString initialize] will enable/disable the NSTaggedPointerString feature. If u implement one in category, your app will not recognize a Tagged Pointer String.
https://github.com/SnowGirls/iCategory-NSString/tree/master/iCategory-NSString
https://github.com/SnowGirls/iCategory-NSString/blob/main/iCategory-NSString/NSString%2BExtension.m#L16
The reason is that your own +initialize method called, the original +[NSString initialize] method never be invoked once.
Reference:
https://github.com/gnustep/libs-base/blob/efccdb1d71166cfe096f309a97747175f46c1435/Source/GSString.m#L3515