Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is this only works on the simulator? #533

Open
Leochens opened this issue Jan 14, 2025 · 6 comments
Open

Is this only works on the simulator? #533

Leochens opened this issue Jan 14, 2025 · 6 comments

Comments

@Leochens
Copy link

hi,there!
Injection3 is worked on simulator now,
I want it work in my physical IOS device, but it seems cannot connect , there is no Injection log in the xcode console.
my current environment:
MACOS:15.1.1
Injection3: 5.0.5
IOS device: 18.0
Xcode: 16.2

@johnno1962
Copy link
Owner

johnno1962 commented Jan 14, 2025

It works on a device but it is more difficult to assemble all the pieces. Consult the README of this project along with that of the HotReloading project to connect. The first step is to set a default to open the app up for remote connections. The simplest method is to add a build phase to copy one of the pre-built bundles into your app as it says in the README.

https://github.com/johnno1962/InjectionIII?tab=readme-ov-file#injection-on-an-ios-tvos-or-visionos-device

@lmhwlc
Copy link

lmhwlc commented Jan 16, 2025

6c9a7a8067c69b0d183e86091200dc7b
4ab0791b8394af3c779b970faf1d9def
I followed the instructions in the tutorial, first executing defaults write com.johnholdsworth.InjectionIII deviceUnlock any, then adding the script. The script was executed successfully, but it still didn't work when running on the real device. The simulator was normal.

@johnno1962
Copy link
Owner

johnno1962 commented Jan 16, 2025

There is more information on debugging connecting over the network here:
https://github.com/johnno1962/HotReloading?tab=readme-ov-file#device-injection
You don't need to use the HotReloading project when you're using the copy_bundle.sh script.

@lmhwlc
Copy link

lmhwlc commented Jan 16, 2025

Do I have to use this package to debug on a real machine? According to the tutorial, I only added and executed the script, and then changed the settings. Is that not enough?

@johnno1962
Copy link
Owner

The bundles contain the code that is in. the HotReloading project. Using the script + loading the bundle should be enough once you have sorted out the networking issues.

@johnno1962
Copy link
Owner

johnno1962 commented Jan 16, 2025

Note that if you use the prebuilt bundles for on device injection the code to load the bundle I different:

#if DEBUG
if let path = Bundle.main.path(forResource:
        "iOSInjection", ofType: "bundle") ??
    Bundle.main.path(forResource:
        "macOSInjection", ofType: "bundle") {
    Bundle(path: path)!.load()
}
#endif

You'lll have to convert that into Objective-C though the classes used should be the same.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants