我已经解密了一些头文件,这是我想要从中删除一些ivars的头文件。
/**
* This header is generated by class-dump-z 0.2a.
* class-dump-z is Copyright (C) 2009 by KennyTM~, licensed under GPLv3.
*
* Source: (null)
*/
#import <XXUnknownSuperclass.h> // Unknown library
#import "InAppNotificationMessageViewDelegate.h"
#import "FBMSessionClassProvidable.h"
@class InAppNotificationContainerView, ProjectGatingChecker, FBMViewProvider, InAppNotificationBadgeCounter, FBMBeeperListFetcher;
@protocol FBMNavigator, FBProvider, FBMAppProperties;
@interface InAppNotificationManager : XXUnknownSuperclass <InAppNotificationMessageViewDelegate, FBMSessionClassProvidable> {
id<FBMNavigator> _navigator;
FBMBeeperListFetcher* _beeperListFetcher;
InAppNotificationBadgeCounter* _badgeCounter;
FBMViewProvider* _notificationMessageViewProvider;
InAppNotificationContainerView* _notificationContainerView;
FBMViewProvider* _notificationContainerViewProvider;
id<FBMAppProperties> _appProperties;
ProjectGatingChecker* _gatingChecker;
id<FBProvider> _rootNavControllerProvider;
id<FBProvider> _threadViewControllerProvider;
}
@property(retain, nonatomic) id<FBMAppProperties> appProperties;
@property(retain, nonatomic) id<FBProvider> threadViewControllerProvider;
@property(retain, nonatomic) id<FBMNavigator> navigator;
@property(retain, nonatomic) ProjectGatingChecker* gatingChecker;
所以我想挂钩gatingChecker ivar,我使用了logify并创建了这些行:
%hook InAppNotificationManager
- (void)setGatingChecker:(ProjectGatingChecker* )gatingChecker { %log; %orig; }
- (ProjectGatingChecker* )gatingChecker { %log; ProjectGatingChecker* r = %orig; NSLog(@" = %@", r); return r; }
%end
当我尝试编译时,我得到:
Tweak.xm:9: error: ‘ProjectGatingChecker’ has not been declared
Tweak.xm:9: error: ‘ProjectGatingChecker’ has not been declared
Tweak.xm:9: error: expected initializer before ‘*’ token
Tweak.xm:9: error: expected initializer before ‘*’ token
Tweak.xm:353: error: ‘ProjectGatingChecker’ has not been declared
Tweak.xm:354: error: expected initializer before ‘*’ token
Tweak.xm: In function ‘void _logosLocalInit()’:
Tweak.xm:361: error: ‘_logos_method$_ungrouped$InAppNotificationManager$gatingChecker’ was not declared in this scope
Tweak.xm:361: error: ‘_logos_orig$_ungrouped$InAppNotificationManager$gatingChecker’ was not declared in this scope
make[2]: *** [obj/Tweak.xm.673b4229.o] Error 1
make[1]: *** [internal-library-all_] Error 2
答案 0 :(得分:3)
使用MSHookIvar
挂钩实例变量ProjectGatingChecker *myGatingChecker = MSHookIvar<ProjectGatingChecker *>(self, "_gatingChecker");
您现在可以使用myGatingChecker,它将是指向钩子变量的指针。