-
-
Notifications
You must be signed in to change notification settings - Fork 319
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
InjectionClient/Could not connect: Connection refused 🔥 #490
Comments
Hi, the connection refused message is normal when you're not running the app. The other message happens when you have added the "HotReloading" Swift package at some point in the past and it picks up the wrong version of the SwiftTrace framework from derived data. You'll need to do a clean build to clear the wrong version out. |
Hi, thanks for the reply! What do you mean by "when you're not running the app"? Both the InjectionIII app and my projects app in the simulator are running and I selected the associated project directory. |
Hmmm.. Remove https://github.com/johnno1962/HotReloading as a dependency. You either use that (rarely these days) or the app bundles. If you use both at the same time you get this error. |
Ah interesting, I saw a video where someone did both and it seemed to work, so I thought that's the way to go. What setup would you recommend? Primarily I would like to use it with the visionOS simulator, the actual Vision Pro device and with a Mac (Catalyst) app. I tried removing the HotReloading dependency but that yields in the same error (connection refused). If I load the bundle manually I get:
Very odd. Xcode is installed via Xcodes app(https://www.xcodes.app) if that has any relevance. |
Ignore the "connection refused" if you are not using the app. If you have removed the HotReloading Package did you perform a build clean afterwards? If you have a visionOS device I'd be very interested in knowing if you were able to get that working. There is a release candidate which should have support for that. I can talk you through that once you're up and running. |
Thanks for your help again! :) Got it running now in the Simulator after removing the HotReloading package and doing a clean build. Very cool! In this video he is importing both packages and it seems to work, which got me confused: Device injection (on iOS) seems to be working mostly but fails during loading of .dylib: Yes, I have a visionOS device and would love to get it working there as well! |
Update: Got it running now on my Mac and Vision Pro :) |
We're making progress. There are a few moving part to injection and they evolve so it can be confusing. The original injection was The app performing the recompiling and the bundle doing the actual injection then I discovered the bundle could do it all in the simulator. For a real device, you can't load the bundle off your Mac's filesystem so the contents of the bundle are available in the HotReloading package. Then someone pointed out that you can copy a bundle into your app and load that instead of off the filesystem if you use the "copy_bundle.sh" script from the app's resources as a build phase. I've just seen your new message. You're very nearly there using the HotReloading project which is fine. It's strange it's not seeing the dylib file but to my knowledge this is the first time someone has tried on an actual visionOS device. Do you have the option to zoom on this? I'd like to see this running if it's possible. |
OK, so I've read your message properly now. You've got injection working on a Vision Pro! and now it doesn't work on a device? That is likely just a code signing problem. What configuration are you running at the moment? HotReloading on a device? I've checked it and can't see a problem on my machine at the moment. |
Hi, so it's working on all the Simulators, my Mac and my Vision Pro (on device 🎊). The only time where I'm now getting this issue is on my physical iPhone 14 Pro device. Xcode Beta 15.3.0, Sonoma 14.1.2 I also now removed the HotReloading package and opted for just loading everything manually using the code generated by the Injection app when selecting -> Prepare Project |
Interestingly enough, on the physical Vision Pro device I could load the iOSInjection bundle and it still worked. Probably similar enough ->
|
Very, very weird about the bundles. Where is that code you pasted in coming from? And visionOS is actually injecting now? That would be awesome! Not sure what's happening on the iOS device. I've seen the error you're seeing today whereas it's worked before. Trying to factor out between new Xcode, new iOS version, changes to InjectionIII etc. It should be code signing correctly. |
Here is the helper snippet I'm using (collected from a couple different sources, mostly "Prepare Project" helper): Yeah visionOS works totally fine :) I can try it maybe with another iPhone. |
Found the silly problem due to renaming a file which was taking out code signing and I'll release a new release candidate this evening. Thanks for checking all these things out! |
Awesome, thanks so much for this project! Already seeing how this will greatly accelerate my workflow :) |
I've updated the release candidate with this fix. You should find on-iOS device injection is working again. Thanks for the link to @gonchar's excellent video. I had no idea people had already got injection working on a visionOS device (as it should!) |
Excellent, that did the trick! Thanks so much! :) |
Thanks for raising the issue. It cleared up all sorts of things :) |
Hi,
I finally wanted to implement Injection into my workflow. I think I've followed all the steps from readme but every time in run my project I get this console message:
InjectionClient/Could not connect: Connection refused 🔥 Unable to connect to InjectionIII app, falling back to standalone HotReloading.
Error loading /Applications/InjectionIII.app/Contents/Resources/iOSInjection.bundle/iOSInjection (82): dlopen(/Applications/InjectionIII.app/Contents/Resources/iOSInjection.bundle/iOSInjection, 0x0109): Symbol not found: _$sSS10SwiftTraceE11OffsetIndexO4lastyACSS_S2btcACmFWC
Here are the steps I've taken:
https://github.com/johnno1962/InjectionIII/releases
2. Install Dependencies:
https://github.com/johnno1962/HotReloading
https://github.com/krzysztofzablocki/Inject
3. Add Linker (DEBUG) Flags:
-Xlinker and -interposable
4. Load Bundle on App Init
#if DEBUG
#if os(visionOS)
Bundle(path: "/Applications/InjectionIII.app/Contents/Resources/xrOSInjection.bundle")?.load()
#elseif targetEnvironment(macCatalyst)
Bundle(path: "/Applications/InjectionIII.app/Contents/Resources/macOSInjection.bundle")?.load()
#else
Bundle(path: "/Applications/InjectionIII.app/Contents/Resources/iOSInjection.bundle")?.load()
#endif
#endif
I've tested it with Xcode 15.2.0 and Xcode 15.3.0 Beta 2.
OS is Sonoma 14.1.2
It's probably something simple but I would appreciate any hints. Thank you!
The text was updated successfully, but these errors were encountered: