Jump to content

Go to solution Solved by Diversityy,

18 posts in this topic

Recommended Posts

Posted

How to hook the method with void and bool?I write like this, but I don't know why can't work.

#include <substrate.h>

 

%hook UserProfessionObj

-(void) setRed:(BOOL)a

{

return %orig(a);

a = TRUE;

}

%end

 

<dict>

<key>methodObjc</key>

<dict>

<key>className</key>

<string>UserProfessionObj</string>

<key>displayName</key>

<string>-(void) setRed:(BOOL)</string>

<key>prefix</key>

<string>-</string>

<key>selector</key>

<string>setRed:</string>

<key>typeEncoding</key>

<string>v12@0:4c8</string>

</dict>

<key>name</key>

<string>Unit for -(void) setRed:(BOOL)</string>

<key>overrides</key>

<array>

<dict>

<key>argument</key>

<integer>1</integer>

<key>type</key>

<dict>

<key>subtype</key>

<integer>0</integer>

<key>type</key>

<integer>5</integer>

</dict>

<key>value</key>

<dict>

<key>type</key>

<integer>5</integer>

<key>value</key>

<true/>

</dict>

</dict>

</array>

this is in flex method,please help me!!

Posted (edited)

what is all these?

 

 

<dict>
<key>methodObjc</key>
<dict>
<key>className</key>
<string>UserProfessionObj</string>
<key>displayName</key>
<string>-(void) setRed:(BOOL)</string>
<key>prefix</key>
<string>-</string>
<key>selector</key>
<string>setRed:</string>
<key>typeEncoding</key>
<string>v12@0:4c8</string>
</dict>
<key>name</key>
<string>Unit for -(void) setRed:(BOOL)</string>
<key>overrides</key>
<array>
<dict>
<key>argument</key>
<integer>1</integer>
<key>type</key>
<dict>
<key>subtype</key>
<integer>0</integer>
<key>type</key>
<integer>5</integer>
</dict>
<key>value</key>
<dict>
<key>type</key>
<integer>5</integer>
<key>value</key>
<true/>
</dict>
</dict>
</array>

did you follow a tutorial?

Updated by ITz_kser
Posted (edited)

what is all these?

 

 

<dict>

<key>methodObjc</key>

<dict>

<key>className</key>

<string>UserProfessionObj</string>

<key>displayName</key>

<string>-(void) setRed:(BOOL)</string>

<key>prefix</key>

<string>-</string>

<key>selector</key>

<string>setRed:</string>

<key>typeEncoding</key>

<string>v12@0:4c8</string>

</dict>

<key>name</key>

<string>Unit for -(void) setRed:(BOOL)</string>

<key>overrides</key>

<array>

<dict>

<key>argument</key>

<integer>1</integer>

<key>type</key>

<dict>

<key>subtype</key>

<integer>0</integer>

<key>type</key>

<integer>5</integer>

</dict>

<key>value</key>

<dict>

<key>type</key>

<integer>5</integer>

<key>value</key>

<true/>

</dict>

</dict>

</array>

did you follow a tutorial?

 

 

 

I want to use flex to build function,then writing a tweak,but I don't actually know the function such as -(void) setRed:(BOOL).Furthermore how to make bool active?@_@

Updated by QQRK
Posted

The <dict>

<key>

<string>

Are for preference bundle

And they shouldn't be in tweak.xm

idk if this will make a different but try to change BOOL to bool

Posted

Okay, so..

%hook UserProfessionObj
-(void) setRed:(BOOL)a
{
%orig(TRUE);
}
%end
Try that. Like what ITz_kser said, you do not include those key, string, dict on your tweak.xm.
Posted

here come another question, how to write a return?  should i change id to null and int to 1 ? (see the picture below the link)

 

http://www.jnbhgbox.org/forum.php?mod=attachment&aid=MjYxNHxmZTA5ZGRhY3wxNDQ4MTY5MTMwfDE5fDUyOQ%3D%3D&nothumb=yes

%hook MGTwitterHTTPURLConnection
-(id)initWithRequest:(id)delegate:(id)requestType:(int)responseTime:(int)
{
return;
}
%end
I believe it's like that. What app are you trying to do this on?
Posted
%hook MGTwitterHTTPURLConnection
-(id)initWithRequest:(id)delegate:(id)requestType:(int)responseTime:(int)
{
return;
}
%end
I believe it's like that. What app are you trying to do this on?

 

like what i think you need to give every function from these a return or the functions that's you want will not work that's what i test

but didn't test the id :turned:

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
  • Create New...

Important Information

We would like to place cookies on your device to help make this website better. The website cannot give you the best user experience without cookies. You can accept or decline our cookies. You may also adjust your cookie settings. Privacy Policy - Guidelines