【问题标题】:Class hooking - Mobile Substrate returning values类挂钩 - Mobile Substrate 返回值
【发布时间】:2014-09-01 19:42:03
【问题描述】:

我目前正在学习如何与 Mobile Substrate(运行时或其他)挂钩,我有点困惑。我正在尝试做一个有趣的调整,将我的 Natwest 平衡更改为字符串。我正在使用一种叫做“theos”的东西。

这是我目前无法使用的代码:

%hook AccountSummaryBaseView
- (id)accountBalanceLabel {
  NSString *temp = [NSString stringWithFormat:@"£999,999.99"];
  return temp;
  %orig;
}
%end

有人能指出我正确的方向吗?这将帮助我了解如何将它与其他类和方法一起使用。

我在 AccountSummaryBaseView 类中有这些方法:

(void)setAccountSummary:(id)
(id)accountSummary
(id)paymentBeneficiary
(void)setPaymentBeneficiary
(id)accountTypeLabel
(id)accountNumberAndSortCodeLabel
(id)aliasLabel
(void)updateBalance
(id)accountLogoImageView
(id)accountBalanceLabel
(id)payeeAccountNumber
(id)fundsAvailableLabel
(void)setAccountLogoImageView:(id)
(void)setAccountTypeLabel:(id)
(void)setAliasLabel:(id)
(void)setAccountNumberAndSortCodeLabel:(id)
(void)setAccountBalanceLabel:(id)
(void)setFundsAvailableLabel:(id)
(void)setPayeeAccountNumber:(id)
(id)initWithFrame:(CGRect)
(void)dealloc
(void)setEnabled:(BOOL)
(BOOL)enabled
(int)accountType:(id)

【问题讨论】:

    标签: c++ ios objective-c c cydia-substrate


    【解决方案1】:

    试试这个:

    %hook AccountSummaryBaseView
    
    -(void)setAccountBalanceLabel:(id)arg {
    
       NSString *temp = [NSString stringWithFormat:@"£999,999.99"];
       %orig(temp);
    
    }
    
    %end
    

    祝你好运;)

    【讨论】:

    • 啊!调用 %orig 就像调用 'self' 一样吗?:) 我没能让它工作,伙计哈哈,由于某种原因它不会在屏幕上改变 - 你认为 arg 需要作为一个返回浮动或nsnumber或什么? :) 干杯!
    • %orig;调用原始方法。 AccountBalanceLabel 是一个属性,而 setAccountBalanceLabel 是它的设置器。因此,当调用 %orig(temp) 时,您只是设置了方法的参数。
    猜你喜欢
    • 2015-07-05
    • 2017-03-04
    • 1970-01-01
    • 1970-01-01
    • 2011-05-31
    • 1970-01-01
    • 1970-01-01
    • 2022-01-27
    • 1970-01-01
    相关资源
    最近更新 更多