Skip to content

Instantly share code, notes, and snippets.

@friggog
Last active August 23, 2022 15:43
Show Gist options
  • Save friggog/03a2483b8acb9abdcd34 to your computer and use it in GitHub Desktop.
Save friggog/03a2483b8acb9abdcd34 to your computer and use it in GitHub Desktop.

#Loading Tweaks in the Simulator

With the latest updates to the simulator, this turns out to be pretty simple:

You need to be using kirb/theos

In order not to require MobileSubstrate to be loaded and your tweak to be compiled for i386/x86_64, add

In your makefile:

TARGET = simulator:clang:latest:7.0
tweakname_USE_SUBSTRATE = 0

Then run the simulator and enter in terminal:

xcrun simctl spawn booted launchctl debug system/com.apple.SpringBoard --environment DYLD_INSERT_LIBRARIES=.theos/obj/debug/Blah.dylib
xcrun simctl spawn booted launchctl stop com.apple.SpringBoard

(from conradev)

This should work for any process, though I havent tried.

DYLD_INSERT_LIBRARIES is a colon seperated list, so multiple dylibs can be loaded.

If deploying to the iOS 9 simulator you'll need to replace

#if TARGET_IPHONE || TARGET_IPHONE_SIMULATOR

with

#if TARGET_IPHONE || TARGET_OS_SIMULATOR

in $THEOS/prefix.pch as TARGET_IPHONE_SIMULATOR is deprecated in iOS 9 (fixed in the latest version of kirb/theos)

If you're having any further problems it's probably due to a dodgy theos setup - I'd recommend installing fresh from kirb/theos

@CFarzaneh
Copy link

Hey everything works perfectly with iOS 9 simulator but when I run the same command on 8.4 simulator I get:
Unrecognized subcommand: debug

I tried removing that argument and I still get errors

@greenywd
Copy link

@CreativityKills @CFarzaneh You need to use the iOS 9 sim, anything else won't work (at this point in time)

@jirachi155
Copy link

Any way to load PreferenceBundles too? Need to test a tweak with settings!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment