Jump to content

 Something great is coming! 🤖

Stay tuned for the big reveal happening here on iOSGods on the 20th of February!

The countdown has finished!

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

    • Slayer Legend v600.6.8 Jailed Cheats +5
      Modded/Hacked App: Slayer Legend By GEAR2
      Bundle ID: com.gear2.growslayer
      iTunes Store Link: https://apps.apple.com/us/app/slayer-legend/id1635712706?uo=4

       

      📌 Mod Requirements

      - Non-Jailbroken/Jailed or Jailbroken iPhone or iPad.
      - Sideloadly or alternatives.
      - Computer running Windows/macOS/Linux with iTunes installed.

       

      🤩 Hack Features

      - Multiply Attack
      - Multiply Defense
      - God Mode
      - One Hit Kill
      - Freeze Currencies

       

      ⬇️ iOS Hack Download IPA Link: https://iosgods.com/topic/189204-slayer-legend-v60061-jailed-cheats-5/
      • 72 replies
    • Three Kingdoms All-Star : Idle (Auto Update) +3 Cheat
      Modded/Hacked App: Three Kingdoms All-Star : Idle By Highbrow
      Bundle ID: com.highbrow.games.tki
      iTunes Store Link: https://apps.apple.com/us/app/three-kingdoms-all-star-idle/id6737404289?uo=4

       


      🤩 Hack Features

      - No Skill Cooldown
        • Haha
      • 48 replies
    • Match Valley v3750 [ +5 Jailed ] Coins Max
      Modded/Hacked App: Match Valley By TALEMONSTER OYUN YAZILIM VE PAZARLAMA ANONIM SIRKETI
      Bundle ID: com.talemonster.matchvalley
      iTunes Store Link: https://apps.apple.com/us/app/match-valley/id6511226434?uo=4


      🤩 Hack Features

      - Coins
      - Lives
      - Potion
      - Booster

      - Up Cost 0
      • 28 replies
    • Match Valley v3750 [ +5 Cheats ] Coins Max
      Modded/Hacked App: Match Valley By TALEMONSTER OYUN YAZILIM VE PAZARLAMA ANONIM SIRKETI
      Bundle ID: com.talemonster.matchvalley
      iTunes Store Link: https://apps.apple.com/us/app/match-valley/id6511226434?uo=4


      🤩 Hack Features

      - Coins
      - Lives
      - Potion
      - Booster

      - Up Cost 0
      • 27 replies
    • Hungry Shark World v7.5.1 [ +9 Cheats ] Currency Max
      Modded/Hacked App: Hungry Shark World By Ubisoft
      Bundle ID: com.ubisoft.hungrysharkworld
      iTunes Store Link: https://apps.apple.com/us/app/hungry-shark-world/id1046846443?uo=4


      Hack Features:
      - ADS NO

      - Gems

      - Coins 

      - Pearls 

      - Premium Pass

      - Health Auto Drain [ OFF ]

      - Boost Max 

      - Score Multi 

      - Revive Max 


      Non-Jailbroken & No Jailbreak required hack(s): https://iosgods.com/forum/79-no-jailbreak-section/
      Modded Android APK(s): https://iosgods.com/forum/68-android-section/
      For more fun, check out the Club(s): https://iosgods.com/clubs/
        • Informative
      • 101 replies
    • Hungry Shark Evolution v13.7.3 [ +9 Cheats ] Never Die
      Modded/Hacked App: Hungry Shark Evolution By Ubisoft
      Bundle ID: com.fgol.HungrySharkEvolution
      iTunes Store Link: https://apps.apple.com/us/app/hungry-shark-evolution/id535500008?uo=4



      Hack Features:

      - ADS NO

      - Gems Unlimited 

      - Coins Unlimited 

      - Health [ Auto Drain OFF ]

      - Booster Freeze 

      - Speed Hack 

      - Wall Break [ Only For Small Shark ]

      - Score Multi 

      - Invincible [ After Respawn ] Never Die
        • Agree
      • 102 replies
    • Royal Kingdom v26531 [ +11 Jailed ] Auto Win
      Modded/Hacked App: Royal Kingdom By Dream Games Teknoloji Anonim Sirketi
      Bundle ID: com.dreamgames.royalkingdom
      iTunes Store Link: https://apps.apple.com/us/app/royal-kingdom/id1606549505?uo=4


      Hack Features:

      - Coins [ Win Match ]

      - Potions

      - Lives Free

      - Booster Max

      - ViP Frame Unlock

      - Kingdom Pass Free

      - District unlock [ One Task Only ]

      - Auto Win [ Just One Move ]

      - Colour Spawn [ Blue Green Red Yellow Pink Orange ] Choose One Only


      Jailbreak required hack(s): https://iosgods.com/forum/5-game-cheats-hack-requests/
      Modded Android APK(s): https://iosgods.com/forum/68-android-section/
      For more fun, check out the Club(s): https://iosgods.com/clubs/
      • 115 replies
    • Royal Kingdom v26531 [ +11 Cheats ] Auto Win
      Modded/Hacked App: Royal Kingdom By Dream Games Teknoloji Anonim Sirketi
      Bundle ID: com.dreamgames.royalkingdom
      iTunes Store Link: https://apps.apple.com/us/app/royal-kingdom/id1606549505?uo=4

      Hack Features:
      - Coins [ Win Match ]

      - Potions

      - Lives Free

      - Booster Max

      - ViP Frame Unlock

      - Kingdom Pass Free

      - District unlock [ One Task Only ]

      - Auto Win [ Just One Move ]

      - Colour Spawn [ Blue Green Red Yellow Pink Orange ] Choose One Only
        • Like
      • 91 replies
    • Travel Merge Family v2.961 [ +1++ Cheats ] Currency Max
      Travel Merge Family

      🤩 Hack Features

      - Currency Max 
      • 18 replies
    • Travel Merge Family v2.961 [ +1++ Jailed ] Currency Max
      Modded/Hacked App: Travel Merge Family By Arruga Corp.
      Bundle ID: com.ArrugaCorp.TravelMergeFamily
      App Store Link: https://apps.apple.com/us/app/travel-merge-family/id6553995556?uo=4


      🤩 Hack Features

      - Currency Max
      • 21 replies
    • Crozzle - Crossword Puzzles v1.47.1 [ +3 Cheats ] Currency Max
      Modded/Hacked App: Crozzle - Crossword Puzzles By MAG Interactive AB
      Bundle ID: se.maginteractive.crozzle
      App Store Link: https://apps.apple.com/ph/app/crozzle-crossword-puzzles/id6474729809?uo=4

      🤩 Hack Features

      - Auto ADS OFF
      - Unlimited Currency / Visual But Works
      - Unlimited Resources / Visual But Works
      • 15 replies
    • Crozzle - Crossword Puzzles v1.47.1 [ +3 Jailed ] Currency Max
      Modded/Hacked App: Crozzle - Crossword Puzzles By MAG Interactive AB
      Bundle ID: se.maginteractive.crozzle
      App Store Link: https://apps.apple.com/ph/app/crozzle-crossword-puzzles/id6474729809?uo=4

      🤩 Hack Features

      - Auto ADS OFF
      - Unlimited Currency / Visual But Works
      - Unlimited Resources / Visual But Works
      • 14 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