Jump to content

how to use ( if ) command After -(id)


Go to solution Solved by AnotherLurker,

5 posts in this topic

Recommended Posts

Posted (edited)

No  One To Help Me ?


Hi 

I'm New In Theos and i want to learn how to use ( if ) command after (-(id)) for example:

NSDictionary *Mykey = [[NSDictionary alloc] initWithContentsOfFile:@"var/mobile/Library/Preferences/net.iperis.mypkg.plist"];

%hook PSUISoftwareUpdateController
-(id)init{
if([[Mykey objectForKey:@"softwareUpdate"] boolValue]){
%orig(nil);
}else{
return %orig;
}
}
%end

But Not Working , How Fix This Example ...

Updated by iP3S1M
Posted

You can't have NSDictionary initialized as a global variable, instead you should set MyKey to null, then check to see if initialized in init()
Here's an example (Contains a few other fixes as well):

NSDictionary *Mykey = NULL;

%hook PSUISoftwareUpdateController
-(id)init {
    if (!Mykey) {
        Mykey = [NSDictionary dictionaryWithContentsOfFile:@"/User/Library/Preferences/net.iperis.mypkg.plist"];
    }

    if([[Mykey objectForKey:@"softwareUpdate"] boolValue]){
        return %orig(nil);
    }

    return %orig();
}
%end
Posted

 

You can't have NSDictionary initialized as a global variable, instead you should set MyKey to null, then check to see if initialized in init()

Here's an example (Contains a few other fixes as well):

NSDictionary *Mykey = NULL;

%hook PSUISoftwareUpdateController
-(id)init {
    if (!Mykey) {
        Mykey = [NSDictionary dictionaryWithContentsOfFile:@"/User/Library/Preferences/net.iperis.mypkg.plist"];
    }

    if([[Mykey objectForKey:@"softwareUpdate"] boolValue]){
        return %orig(nil);
    }

    return %orig();
}
%end

Not Working 

This is my Tweak.xm

 

NSDictionary *Mykey = NULL;

%hook PSUISoftwareUpdateController
-(id)init {
    if (!Mykey) {
        Mykey = [NSDictionary dictionaryWithContentsOfFile:@"/User/Library/Preferences/net.iperis.mypkg.plist"];
    }

    if([[Mykey objectForKey:@"softwareUpdate"] boolValue]){
        return %orig(nil);
    }

    return %orig();
}
%end

Output In Terminal 

 

iPhone:/var/mobile/projects/mypkg root# make package install
Making all for tweak mypkg...
 Preprocessing Tweak.xm...
Constants from lexical variables potentially modified elsewhere are deprecated at /private/var/theos/bin/lib/aliased.pm line 42.
Constants from lexical variables potentially modified elsewhere are deprecated at /private/var/theos/bin/lib/aliased.pm line 42.
Constants from lexical variables potentially modified elsewhere are deprecated at /private/var/theos/bin/lib/aliased.pm line 42.
Constants from lexical variables potentially modified elsewhere are deprecated at /private/var/theos/bin/lib/aliased.pm line 42.
Constants from lexical variables potentially modified elsewhere are deprecated at /private/var/theos/bin/lib/aliased.pm line 42.
Constants from lexical variables potentially modified elsewhere are deprecated at /private/var/theos/bin/lib/aliased.pm line 42.
Constants from lexical variables potentially modified elsewhere are deprecated at /private/var/theos/bin/lib/aliased.pm line 42.
Constants from lexical variables potentially modified elsewhere are deprecated at /private/var/theos/bin/lib/aliased.pm line 42.
 Compiling Tweak.xm...
Tweak.xm:37:85: error: too many arguments to function call, expected 2, have 3
  ..._logos_orig$_ungrouped$PSUISoftwareUpdateController$init(self, _cmd, nil);
     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~             ^~~
/var/mobile/projects/mypkg/theos/sdks/iPhoneOS8.1.sdk/usr/include/MacTypes.h:93:17: note:
      expanded from macro 'nil'
    #define nil __DARWIN_NULL
                ^~~~~~~~~~~~~
/var/mobile/projects/mypkg/theos/sdks/iPhoneOS8.1.sdk/usr/include/sys/_types.h:43:23: note:
      expanded from macro '__DARWIN_NULL'
#define __DARWIN_NULL __null
                      ^~~~~~
1 error generated.
make[2]: *** [obj/Tweak.xm.05f97c77.o] Error 1
make[1]: *** [internal-library-all_] Error 2
make: *** [iOSTool.all.tweak.variables] Error 2
iPhone:/var/mobile/projects/iostool root#

  • Solution
Posted

Not Working 

This is my Tweak.xm

 

NSDictionary *Mykey = NULL;

%hook PSUISoftwareUpdateController
-(id)init {
    if (!Mykey) {
        Mykey = [NSDictionary dictionaryWithContentsOfFile:@"/User/Library/Preferences/net.iperis.mypkg.plist"];
    }

    if([[Mykey objectForKey:@"softwareUpdate"] boolValue]){
        return %orig(nil);
    }

    return %orig();
}
%end
Output In Terminal 

 

iPhone:/var/mobile/projects/mypkg root# make package install
Making all for tweak mypkg...
 Preprocessing Tweak.xm...
Constants from lexical variables potentially modified elsewhere are deprecated at /private/var/theos/bin/lib/aliased.pm line 42.
Constants from lexical variables potentially modified elsewhere are deprecated at /private/var/theos/bin/lib/aliased.pm line 42.
Constants from lexical variables potentially modified elsewhere are deprecated at /private/var/theos/bin/lib/aliased.pm line 42.
Constants from lexical variables potentially modified elsewhere are deprecated at /private/var/theos/bin/lib/aliased.pm line 42.
Constants from lexical variables potentially modified elsewhere are deprecated at /private/var/theos/bin/lib/aliased.pm line 42.
Constants from lexical variables potentially modified elsewhere are deprecated at /private/var/theos/bin/lib/aliased.pm line 42.
Constants from lexical variables potentially modified elsewhere are deprecated at /private/var/theos/bin/lib/aliased.pm line 42.
Constants from lexical variables potentially modified elsewhere are deprecated at /private/var/theos/bin/lib/aliased.pm line 42.
 Compiling Tweak.xm...
Tweak.xm:37:85: error: too many arguments to function call, expected 2, have 3
  ..._logos_orig$_ungrouped$PSUISoftwareUpdateController$init(self, _cmd, nil);
     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~             ^~~
/var/mobile/projects/mypkg/theos/sdks/iPhoneOS8.1.sdk/usr/include/MacTypes.h:93:17: note:
      expanded from macro 'nil'
    #define nil __DARWIN_NULL
                ^~~~~~~~~~~~~
/var/mobile/projects/mypkg/theos/sdks/iPhoneOS8.1.sdk/usr/include/sys/_types.h:43:23: note:
      expanded from macro '__DARWIN_NULL'
#define __DARWIN_NULL __null
                      ^~~~~~
1 error generated.
make[2]: *** [obj/Tweak.xm.05f97c77.o] Error 1
make[1]: *** [internal-library-all_] Error 2
make: *** [iOSTool.all.tweak.variables] Error 2
iPhone:/var/mobile/projects/iostool root#

 

Oh, didn't see your other mistake, here you go:

NSDictionary *Mykey = NULL;

%hook PSUISoftwareUpdateController
-(id)init {
    if (!Mykey) {
        Mykey = [NSDictionary dictionaryWithContentsOfFile:@"/User/Library/Preferences/net.iperis.mypkg.plist"];
    }

    if([[Mykey objectForKey:@"softwareUpdate"] boolValue]){
        return nil;
    }

    return %orig();
}
%end
Posted

Oh, didn't see your other mistake, here you go:

NSDictionary *Mykey = NULL;

%hook PSUISoftwareUpdateController
-(id)init {
    if (!Mykey) {
        Mykey = [NSDictionary dictionaryWithContentsOfFile:@"/User/Library/Preferences/net.iperis.mypkg.plist"];
    }

    if([[Mykey objectForKey:@"softwareUpdate"] boolValue]){
        return nil;
    }

    return %orig();
}
%end

 

Special Thanks For You ... Fixed  (y) .

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
  • Our picks

    • Truck Simulator Big Rigs v1.5.4 [ +1 Cheats ] Currency
      Modded/Hacked App: Truck Simulator Big Rigs By DualCarbon Ltd
      Bundle ID: com.dualcarbon.bigrigstruckadventure
      App Store Link: https://apps.apple.com/us/app/truck-simulator-big-rigs/id6752597004?uo=4

      🤩 Hack Features

      - Cash / Increase Instead Of Decrease
      • 1 reply
    • Truck Simulator Big Rigs v1.5.4 [ +1 Jailed ] Currency
      Modded/Hacked App: Truck Simulator Big Rigs By DualCarbon Ltd
      Bundle ID: com.dualcarbon.bigrigstruckadventure
      App Store Link: https://apps.apple.com/us/app/truck-simulator-big-rigs/id6752597004?uo=4

      🤩 Hack Features

      - Cash / Increase Instead Of Decrease
      • 1 reply
    • One Punch Man World v1.2.0 +2 Cheats
      Mod APK Game Name: One Punch Man World By Crunchyroll Games, LLC
      Rooted Device: Not Required.
      Google Play Store Link: https://play.google.com/store/apps/details?id=com.crunchyroll.opm

       

      🤩 Hack Features

      - Damage Multiplier
      - Defense Multiplier

       

      ⬇️ Android Mod APK Download Link


      Hidden Content

      Download Modded APK







       

      📖 Android Installation Instructions

      STEP 1: Download the modded APK file from the link above using your preferred Android browser or download manager.
      STEP 2: Once the download is complete, open your file manager and locate the downloaded .apk file (usually in the Downloads folder).
      STEP 3: Tap the APK file, then select Install. If prompted, enable Install from Unknown Sources in your device settings.
      STEP 3A: If the mod includes an OBB file, extract it if it’s inside an archive. Then move the folder to: /Android/obb/
      STEP 3B: If the mod includes a DATA file, extract it if it’s archived. Then move the folder to: /Android/data/
      STEP 4: Once installed, open the game and toggle your desired cheats & features through the APK mod menu. Enjoy!

       

      NOTE: If you have any questions or issues, read our Frequently Asked Questions topic. If you still need help, post your issue below and we’ll assist you as soon as possible. If the mod works for you, please share your feedback to help other members!

       

      🙌 Credits

      - AlyssaX64

       

      📷 Cheat Video/Screenshots

      N/A

       

       iOS & iPadOS App Hacks
      If you’re looking for Non-Jailbroken & No Jailbreak required iOS IPA hacks, visit the iOS Game Cheats & Hacks or the iOSGods App for a variety of modded games and apps for non-jailbroken iOS devices.
      • 0 replies
    • Only Grind: Loot & Fight v1.3.2 [ +8 APK MOD ] Currency Max
      Mod APK Game Name: Only Grind: Loot & Fight
      Rooted Device: Not Required.
      Google Play Store Link: https://play.google.com/store/apps/details?id=io.onlychads.onlygrind&hl=en

      🤩 Hack Features

      - Success Rate Gems [ Upgrade Then Get ]
      - Gold [ Sell Then Get ]
      - Gold [ Merge Gems Then Get ]
      - Gold [ Upgrade Then Get ]
      - HP
      - DEF
      - ATK
      - Criti DMG
      • 1 reply
    • DEAD TARGET: FPS Zombie Games v6.166.0 [ +10 Cheats ] Currency Max
      Modded/Hacked App: DEAD TARGET: FPS Zombie Games By VNG SINGAPORE PTE LTD
      Bundle ID: com.vng.g6.a.zombie
      iTunes Store Link: https://apps.apple.com/us/app/dead-target-fps-zombie-games/id901793885?uo=4
       

      Hack Features

      - Unlimited Gold
      - Unlimited Cash

      - Unlimited Diamonds
      - Unlimited Grenades
      - Unlimited MedKits
      - Unlimited Ammo
      - One Hit Kill
      - God Mode
      - High Accuracy

      - ADS NO
      • 37 replies
    • DEAD TARGET: FPS Zombie Games v6.166.0 [ +10 Jailed ] Currency Max
      Modded/Hacked App: DEAD TARGET: FPS Zombie Games By VNG SINGAPORE PTE LTD
      Bundle ID: com.vng.g6.a.zombie
      iTunes Store Link: https://apps.apple.com/us/app/dead-target-fps-zombie-games/id901793885?uo=4
       

      Hack Features

      - Unlimited Gold
      - Unlimited Cash

      - Unlimited Diamonds
      - Unlimited Grenades
      - Unlimited MedKits
      - Unlimited Ammo
      - One Hit Kill
      - God Mode
      - High Accuracy

      - ADS NO
      • 59 replies
    • Only Grind: Loot & Fight v1.3.2 [ +11 Cheats ] Currency Max
      Modded/Hacked App: Only Grind: Loot & Fight By Chi Ngo
      Bundle ID: io.onlychads.onlygrind
      App Store Link: https://apps.apple.com/us/app/only-grind-loot-fight/id6499444042?uo=4

       
      🤩 Hack Features

      - IAP FREE [ Buy Anything ] ADS

      - Gems [ Earn Then Get ]

      - Success Rate Gems [ UP Then Get ]

      - Chest +5

      - Gold [ Sell Then Get ]

      - Gold [ Merge Gems Then Get ]

      - Gold [ Up Then Get ]

      - HP

      - DEF

      - ATK

      - Criti DMG
      • 5 replies
    • Only Grind: Loot & Fight v1.3.2 [ +11 Jailed ] Currency Max
      Modded/Hacked App: Only Grind: Loot & Fight By Chi Ngo
      Bundle ID: io.onlychads.onlygrind
      App Store Link: https://apps.apple.com/us/app/only-grind-loot-fight/id6499444042?uo=4
       

      🤩 Hack Features

      - IAP FREE [ Buy Anything ] ADS

      - Gems [ Earn Then Get ]

      - Success Rate Gems [ UP Then Get ]

      - Chest +5

      - Gold [ Sell Then Get ]

      - Gold [ Merge Gems Then Get ]

      - Gold [ Up Then Get ]

      - HP

      - DEF

      - ATK

      - Criti DMG
      • 5 replies
    • North War: Island Defense 3D v1.2.2 [ +6 Cheats ] Currency Max
      Modded/Hacked App: North War: Island Defense 3D By ONDI TECHNOLOGY JSC
      Bundle ID: com.bgg.island.battle
      App Store Link: https://apps.apple.com/ph/app/north-war-island-defense-3d/id6744058107?uo=4 

      🤩 Hack Features

      - Unlimited Gems / Use & Earn
      - Unlimited Coins / Use & Earn
      - Unlimited Energy / Use & Earn
      • 27 replies
    • North War: Island Defense 3D v1.2.2 [ +6 Jailed ] Currency Max
      Modded/Hacked App: North War: Island Defense 3D By ONDI TECHNOLOGY JSC
      Bundle ID: com.bgg.island.battle
      App Store Link: https://apps.apple.com/ph/app/north-war-island-defense-3d/id6744058107?uo=4 

      🤩 Hack Features

      - Unlimited Gems / Use & Earn
      - Unlimited Coins / Use & Earn
      - Unlimited Energy / Use & Earn
      • 25 replies
    • Happy Citizens - Mayor Sim v1.5.10 [ +4 Cheats ] Currency Max
      Modded/Hacked App: Happy Citizens - Mayor Sim By MIYA TECH LIMITED
      Bundle ID: com.miyagames.happycitizen.ios
      App Store Link: https://apps.apple.com/ca/app/happy-citizens-mayor-sim/id6745251520?uo=4


      🤩 Hack Features

      - Gems
      - Cash
      - Energy
      - Water
      • 21 replies
    • Happy Citizens - Mayor Sim v1.5.10 [ +4 Jailed ] Currency Max
      Modded/Hacked App: Happy Citizens - Mayor Sim By MIYA TECH LIMITED
      Bundle ID: com.miyagames.happycitizen.ios
      App Store Link: https://apps.apple.com/ca/app/happy-citizens-mayor-sim/id6745251520?uo=4

       
      🤩 Hack Features

      - Gems
      - Cash
      - Energy
      - Water
      • 29 replies
×
  • 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