Jump to content

Preference Bundle Error


Go to solution Solved by Crypto,

24 posts in this topic

Recommended Posts

Posted

I keep getting this I don't know how to fix it

 

Tweak.xm:18:4: error: use of undeclared identifier

'GetPrefBool'

if(GetPrefBool(@"kPlan")) {

^

1 error generated.

make[2]: *** [obj/Tweak.xm.af20312e.o] Error 1

make[1]: *** [internal-library-all_] Error 2

make: *** [magicPiano.all.tweak.variables] Error 2

iPhone:/var/mobile/magicpiano root#

 

THIS IS THE LINE IN THE TWEAK.XM

 

%hook MagicSubscriptionPlan

-(int) period {

if(GetPrefBool(@"kPlan")) {

return 999999999;

}

return %orig;

}

%end

  • Solution
Posted

I'm not 100% sure but try this and don't forget to change the plist name to your preference bundle folder name

 

#define PLIST_PATH @"/var/mobile/Library/Preferences/PREFERENCEBUNDLENAME.plist"

 

inline bool GetPrefBool(NSString *key)

{

return [[[NSDictionary dictionaryWithContentsOfFile:PLIST_PATH] valueForKey:key] boolValue];

}

 

%hook MagicSubscriptionPlan

-(int) period {

if(GetPrefBool(@"kPlan")) {

return 999999999;

}

return %orig;

}

%end

Posted

I'm not 100% sure but try this and don't forget to change the plist name to your preference bundle folder name

#define PLIST_PATH @"/var/mobile/Library/Preferences/PREFERENCEBUNDLENAME.plist"

inline bool GetPrefBool(NSString *key)

{

return [[[NSDictionary dictionaryWithContentsOfFile:PLIST_PATH] valueForKey:key] boolValue];

}

%hook MagicSubscriptionPlan

-(int) period {

if(GetPrefBool(@"kPlan")) {

return 999999999;

}

return %orig;

}

%end

Do I paste The whole thing into Tweak.xm ?
Posted

Do I paste The whole thing into Tweak.xm ?

Yeah but change the PREFERENCEBUNDLENAME.plist to your pref bundle name with the .plist

Posted

Add this at the top:

inline bool GetPrefBool(NSString *key) {
return [[[NSDictionary dictionaryWithContentsOfFile:PLIST_PATH] valueForKey:key] boolValue];
}
Posted

@Patricktph worked?

Yea, but I have a question what if I want to add it to more switches

@Patricktph worked?

Yes but I still have one question if I want to make more than 1 switching an just add this if(GetPrefBool(@"kPlan")) { before return then and add the %orig;

Posted

Add this at the top:

 

inline bool GetPrefBool(NSString *key) {
return [[[NSDictionary dictionaryWithContentsOfFile:PLIST_PATH] valueForKey:key] boolValue];
}
I got the hack switch in my settings but when I turn it on or off it doesn't do anything in the app but Normaly with out the switch for on and off it works..

 

THIS IS MY TWEAK.xm

 

#define PLIST_PATH @"/var/mobile/Library/Preferences/ptest.plist"

 

inline bool GetPrefBool(NSString *key)

{

return [[[NSDictionary dictionaryWithContentsOfFile:PLIST_PATH] valueForKey:key] boolValue];

}

 

%hook MagicPerformanceStats

-(bool) isPerfect {

if(GetPrefBool(@"kPlan")) {

return true;

}

return %orig;

}

%end

AND THIS IS MY Plist

 

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">

<plist version="1.0">

<dict>

<key>items</key>

<array>

<dict>

<key>cell</key>

<string>PSGroupCell</string>

<key>footerText</key>

<string>Magic Piano</string>

</dict>

<dict>

<key>cell</key>

<string>PSSwitchCell</string>

<key>default</key>

<true/>

<key>defaults</key>

<string>com.techprohacker.ptest</string>

<key>key</key>

<string>kPlan</string>

<key>label</key>

<string>VIP ACCESS</string>

</dict>

</array>

<key>title</key>

<string>ptest</string>

</dict>

</plist>

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