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 ?


  On 8/7/2016 at 7:16 PM, iP3S1M said:

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
  On 8/7/2016 at 7:22 PM, JustRick said:

 

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
  On 8/7/2016 at 7:32 PM, iP3S1M said:

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
  On 8/7/2016 at 7:33 PM, JustRick said:

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

    • What Duck v1.0.27 [ +6 Cheats ] Currency Max
      Modded/Hacked App: What Duck By Nexelon inc.
      Bundle ID: com.nexelon.duckwars
      App Store Link: https://apps.apple.com/us/app/what-duck/id6744432301?uo=4

      🤩 Hack Features

      - ADS No [ Rewards Free ]

      - Currency

      - Resources

      - Battle Coins

      - Energy

      - Free Pass [ Claim Unlimited ]
      • 10 replies
    • What Duck v1.0.27 [ +6 Jailed ] Currency Max
      Modded/Hacked App: What Duck By Nexelon inc.
      Bundle ID: com.nexelon.duckwars
      App Store Link: https://apps.apple.com/us/app/what-duck/id6744432301?uo=4


      🤩 Hack Features

      - ADS No [ Rewards Free ]

      - Currency

      - Resources

      - Battle Coins

      - Energy

      - Free Pass [ Claim Unlimited ]
      • 18 replies
    • Paradise Paws: Merge Animals v0.2.5 [ +9 Cheats ] Currency Max
      Modded/Hacked App: Animal Sanctuary By Wildlife Studios, Inc
      Bundle ID: com.wildlifestudios.merge.animal.sanctuary
      App Store Link: https://apps.apple.com/us/app/animal-sanctuary/id6741805691?uo=4
       

      🤩 Hack Features

      - Gems

      - Coins

      - Heart

      - Spin

      - LvL

      - Exp

      - Fog Auto Remove [ Linked With LvL ]

      - Premum Lands Unlocked [ Just Tap ]

      - Store Free [ IAP Not ]

      Note:- Game Close After Currency Hack Don't Worry
      • 15 replies
    • Paradise Paws: Merge Animals v0.2.5 [ +9 Jailed ] Currency Max
      Modded/Hacked App: Animal Sanctuary By Wildlife Studios, Inc
      Bundle ID: com.wildlifestudios.merge.animal.sanctuary
      App Store Link: https://apps.apple.com/us/app/animal-sanctuary/id6741805691?uo=4


      🤩 Hack Features

      - Gems

      - Coins

      - Heart

      - Spin

      - LvL

      - Exp

      - Fog Auto Remove [ Linked With LvL ]

      - Premum Lands Unlocked [ Just Tap ]

      - Store Free [ IAP Not ]

      Note:- Game Close After Currency Hack Don't Worry
      • 8 replies
    • Galaxiga - Classic 80s Arcade V10.89 [ +7 Jailed ] Energy Max
      Modded/Hacked App: Galaxiga - Classic 80s Arcade By ONESOFT GLOBAL PTE. LTD.
      Bundle ID: com.os.space.force.galaxy.alien
      iTunes Store Link: https://apps.apple.com/us/app/galaxiga-classic-80s-arcade/id1519367184?uo=4


      Hack Features:

      - Premium Pass [ Rewards Only ]

      - Energy Unlimited [ Linked Premium Pass ]

      - Plane Unlocked [ Tire 1 Tire 2 ] 

      - Drone Unlocked [ Tire 1 Tire 2 ]

      - Stone Unlocked [ Tire 1 Tire 2 ] 

      - Unlock Gem Cost 0 [ Plane Drone Stone ]

      - Easy Kill [ Only SP - No PVP ] 

      - Win PvP Select Higher Rank [ Plane Drone Stone ] Easy To Win PvP NO Bannnn


      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/
      • 47 replies
    • Galaxiga - Classic 80s Arcade V10.89 [ +7 Cheats ] Energy Max
      Modded/Hacked App: Galaxiga - Classic 80s Arcade By ONESOFT GLOBAL PTE. LTD.
      Bundle ID: com.os.space.force.galaxy.alien
      iTunes Store Link: https://apps.apple.com/us/app/galaxiga-classic-80s-arcade/id1519367184?uo=4


      Mod Requirements:
      - Jailbroken iPhone/iPad/iPod Touch.
      - iGameGod / Filza / iMazing or any other file managers for iOS.
      - Cydia Substrate, ElleKit, Substitute or libhooker depending on your jailbreak.
      - PreferenceLoader (from Cydia, Sileo or Zebra).


      Hack Features:
      - Premium Pass [ Rewards Only ]

      - Energy Unlimited [ Linked Premium Pass ]

      - Plane Unlocked [ Tire 1 Tire 2 ] 

      - Drone Unlocked [ Tire 1 Tire 2 ]

      - Stone Unlocked [ Tire 1 Tire 2 ] 

      - Unlock Gem Cost 0 [ Plane Drone Stone ] Maybe Effect PvP 

      - Easy Kill [ Only SP - No PVP ] 

      - Win PvP Select Higher Rank [ Plane Drone Stone ]

      Not3:- Don't Abuse The Hack Incase Banned Lower Chances Maybe


      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/


      iOS Hack Download Link:

      Hidden Content

      Download Hack
      • 78 replies
    • Candy Pop Story : Match 3 v1.22.0702 [ +3 Cheats ] Auto Win
      Modded/Hacked App: Candy Pop Story : Match 3 By F.O.G LIMITED
      Bundle ID: com.gamoper.candysweetstory.ios
      App Store Link: https://apps.apple.com/us/app/candy-pop-story-match-3/id6670773988?uo=4


      🤩 Hack Features

      - Auto Win
      - Coins
      - Moves
      -
      • 4 replies
    • Candy Pop Story : Match 3 v1.22.0702 [ +3 Jailed ] Auto Win
      Modded/Hacked App: Candy Pop Story : Match 3 By F.O.G LIMITED
      Bundle ID: com.gamoper.candysweetstory.ios
      App Store Link: https://apps.apple.com/us/app/candy-pop-story-match-3/id6670773988?uo=4
       

      🤩 Hack Features

      - Auto Win
      - Coins
      - Moves
      • 5 replies
    • 20 Minutes Till Dawn v6.7.8 [ +12+++ Cheats ] Coins Freeze
      Modded/Hacked App: 20 Minutes Till Dawn By QI YU SG. PTE. LTD.
      Bundle ID: com.flanne.erabit.20minutes.tilldawn.shooting.roguelike.iap.ios
      iTunes Store Link: https://apps.apple.com/us/app/20-minutes-till-dawn/id1635123906?uo=4


      Hack Features:
      - Coins Freeze 

      - Hero Unlocked 

      - Guns Unlocked 

      - Never Die 

      - Ammo Max 

      - No Reload 

      - Rune Unlocked

      - Rune LvL Max

      - Pickup Range [ Linked Rune ] Just Equip

      - DMG Easy Kill [ Linked Rune ] Just Equip

      - Skill CD [ Linked Rune ] Just Equip

      - HP Drop [ Linked Rune ] Just Equip

      - Knockback [ Linked Rune ] Just Equip

      + More Read Status Rune


      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/
      • 33 replies
    • 20 Minutes Till Dawn v6.7.8 [ +12+++ Jailed ] Coins Freeze
      Modded/Hacked App: 20 Minutes Till Dawn By QI YU SG. PTE. LTD.
      Bundle ID: com.flanne.erabit.20minutes.tilldawn.shooting.roguelike.iap.ios
      iTunes Store Link: https://apps.apple.com/us/app/20-minutes-till-dawn/id1635123906?uo=4


      Mod Requirements:
      - Non-Jailbroken/Jailed or Jailbroken iPhone/iPad/iPod Touch.
      - Sideloadly / Cydia Impactor or alternatives.
      - A Computer Running Windows/macOS/Linux with iTunes installed.


      Hack Features:

      - Coins Freeze 

      - Hero Unlocked 

      - Guns Unlocked 

      - Never Die 

      - Ammo Max 

      - No Reload 

      - Rune Unlocked

      - Rune LvL Max

      - Pickup Range [ Linked Rune ] Just Equip

      - DMG Easy Kill [ Linked Rune ] Just Equip

      - Skill CD [ Linked Rune ] Just Equip

      - HP Drop [ Linked Rune ] Just Equip

      - Knockback [ Linked Rune ] Just Equip

      + More Read Status Rune

       
      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/


      iOS Hack Download IPA Link:

      Hidden Content

      Download via the iOSGods App
      • 20 replies
    • Friends Adventure Match v3.5.2 [ +5 Cheats ] Currency Max
      Modded/Hacked App: Friends Adventure Match By NARCADE TEKNOLOJI ANONIM SIRKETI
      Bundle ID: com.nar.FriendsMatch
      iTunes Store Link: https://apps.apple.com/us/app/friends-adventure-match/id6479395668?uo=4

       

      Hack Features

      - Coins [ Win Match ]

      - Lives

      - Stars

      - Booster

      - Moves


      For Non-Jailbroken & No Jailbreak required hacks: https://iosgods.com/forum/79-no-jailbreak-section/
      Modded Android APK(s): https://iosgods.com/forum/68-android-section/

       

      iOS Hack Download Link


      Hidden Content

      Download Hack
      • 5 replies
    • Friends Adventure Match v3.5.2 [ +5 Jailed ] Currency Max
      Modded/Hacked App: Friends Adventure Match By NARCADE TEKNOLOJI ANONIM SIRKETI
      Bundle ID: com.nar.FriendsMatch
      iTunes Store Link: https://apps.apple.com/us/app/friends-adventure-match/id6479395668?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

      - Coins [ Win Match ]

      - Lives

      - Stars

      - Booster

      - Moves


      Jailbreak required iOS hacks: https://iosgods.com/forum/5-game-cheats-hack-requests/
      Modded Android APKs: https://iosgods.com/forum/68-android-section/

       

      iOS Hack Download IPA Link


      Hidden Content

      Download via the iOSGods App
      • 5 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