c++iosobjective-cccydia-substrate

Class hooking - Mobile Substrate returning values


I'm currently learning how to hook with Mobile Substrate (runtime or whatever) and I'm a little confused. I'm trying to make a funny tweak that changes my Natwest balance to a string. I'm using something called "theos".

This is the code I have so far that doesn't work:

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

Could someone point me in the right direction? This would help me to understand how I can use this with other classes and methods.

I have these methods inside of the AccountSummaryBaseView class:

(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)

Solution

  • Try this:

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

    Good Luck ;)