2013-02-21 279 views
1

我正在嘗試使用MSHookIvar獲取ivar,但出現此錯誤:「'MSHookIvar'未在此範圍內聲明」。我試圖在我的iPhone和Mac中編譯它,但都說我有這個錯誤。感謝'MSHookIvar'未在此範圍內聲明

這裏是我的代碼:

#import "substrate.h" 


%hook SBAwayController 




- (void)_unlockWithSound:(BOOL)arg1 unlockSource:(int)arg2 isAutoUnlock:(BOOL)arg3 bypassPinLock:(BOOL)arg4{ 

UIButton *myButton = [UIButton buttonWithType:UIButtonTypeRoundedRect]; 
myButton.frame = CGRectMake(21, 80, 100, 35); 
[myButton setTitle:@"My Button" forState:UIControlStateNormal]; 
[myButton addTarget:self action:@selector(myButtonPressed)  forControlEvents:UIControlEventTouchUpInside]; 

SBUIController *ui = MSHookIvar<id>(self, "_uiController"); 

[[ui window ] addSubview:myButton]; 

%orig(arg1,arg2,arg3,arg4); 

} 

%end 


%hook SBUIController 

- (id)window{ 
return %orig; 
} 



%end 

回答

1

我有這個同樣的問題,請嘗試使用%orig;代替%orig(arg1,arg2,arg3,arg4);。請記住讓我知道它是怎麼回事