Code Monkey home page Code Monkey logo

Comments (18)

johnno1962 avatar johnno1962 commented on May 29, 2024 1

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.

from injectioniii.

johnno1962 avatar johnno1962 commented on May 29, 2024 1

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!

from injectioniii.

johnno1962 avatar johnno1962 commented on May 29, 2024 1

Thanks for raising the issue. It cleared up all sorts of things :)

from injectioniii.

johnno1962 avatar johnno1962 commented on May 29, 2024

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.

from injectioniii.

arthurschiller avatar arthurschiller commented on May 29, 2024

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.
I also tried resetting the Swift Package Manager Cache, cleaned the project, deleted Derived Data and restarted my machine. 🤔

from injectioniii.

johnno1962 avatar johnno1962 commented on May 29, 2024

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.

from injectioniii.

arthurschiller avatar arthurschiller commented on May 29, 2024

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:

`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
  Referenced from: <6E51BEA0-FB33-3620-9771-2B52DA5CF83E> /Applications/InjectionIII.app/Contents/Resources/iOSInjection.bundle/iOSInjection
  Expected in:     <B31C28E6-BD26-31E1-A706-046DFD36C763> /Users/<...>/Library/Developer/Xcode/DerivedData/SGMaterial_Playground-cmnrfbyrdzlqugfcvcotswsakavf/Build/Products/Debug-iphonesimulator/PackageFrameworks/SwiftTrace.framework/SwiftTrace`

Very odd. Xcode is installed via Xcodes app(https://www.xcodes.app) if that has any relevance.

from injectioniii.

johnno1962 avatar johnno1962 commented on May 29, 2024

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.

from injectioniii.

arthurschiller avatar arthurschiller commented on May 29, 2024

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!
I am a little confused though: There is the standalone app (which I assume I can just use as such), the Inject swift package and then the HotReloading package. Which should I use when? Or are they just different wrappers with the same goal?
Currently I have the Injection 3 App running and use the Inject Swift Package.

In this video he is importing both packages and it seems to work, which got me confused:
https://www.loom.com/share/c3331721a6ff47b9a66b30e7b59c6afc

Device injection (on iOS) seems to be working mostly but fails during loading of .dylib:
💉 Connecting to <…>...
💉 InjectionIII connected <…>
💉 Watching files under the directory <…>
💉 Compiling <…>
💉 Selecting Xcode /Applications/Xcode-15.3.0-Beta.2.app/Contents/Developer
💉 Loading .dylib ...
💉 ⚠️ dlopen() error: dlopen(/private/var/mobile/Containers/Data/Application/0E0C77D6-6DCF-4858-BA77-146AC2BC4573/tmp/eval101.dylib, 0x0002): tried: '/usr/lib/system/introspection/eval101.dylib' (no such file, not in dyld cache)

Yes, I have a visionOS device and would love to get it working there as well!

from injectioniii.

arthurschiller avatar arthurschiller commented on May 29, 2024

Update: Got it running now on my Mac and Vision Pro :)
I switched to the HotReloading Package instead of Inject though. But weirdly on my iPhone I still get this dlopen error:
🔥 ⚠️ dlopen() error: dlopen(/private/var/mobile/Containers/Data/Application/89D3960F-D1CF-46F5-A331-994FBB129419/tmp/eval102.dylib, 0x0002): tried: '/usr/lib/system/introspection/eval102.dylib' (no such file, not in dyld cache), '/private/var/mobile/Containers/Data/Application/89D3960F-D1CF-46F5-A331-994FBB129419/tmp/eval102.dylib' (code signature in <A0AFCA02-4C0E-319F-A389-D66F89DAA71C> '/private/var/mobile/Containers/Data/Application/89D3960F-D1CF-46F5-A331-994FBB129419/tmp/eval102.dylib' not valid for use in process: mapped file has no cdhash, completely unsigned? Code has to be at least ad-hoc signed.), '/private/preboot/Cryptexes/OS/private/var/mobile/Containers/Data/Application/89D3960F-D1CF-46F5-A331-994FBB129419/tmp/eval102.dylib' (no such file), '/private/var/mobile/Containers/Data/Application/89D3960F-D1CF-46F5-A331-994FBB129419/tmp/eval102.dylib' (code signature in <A0AFCA02-4C0E-319F-A389-D66F89DAA71C> '/private/var/mobile/Containers/Data/Application/89D3960F-D1CF-46F5-A331-994FBB129419/tmp/eval102.dylib' not valid for use in process: mapped file has no cdhash, completely unsigned? Code has to be at least ad-hoc signed.) 🔥 ⚠️ Injection error: Error Domain=SwiftEval Code=-1 "dlopen() error: dlopen(/private/var/mobile/Containers/Data/Application/89D3960F-D1CF-46F5-A331-994FBB129419/tmp/eval102.dylib, 0x0002): tried: '/usr/lib/system/introspection/eval102.dylib' (no such file, not in dyld cache),

from injectioniii.

johnno1962 avatar johnno1962 commented on May 29, 2024

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.

from injectioniii.

arthurschiller avatar arthurschiller commented on May 29, 2024

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
Still runs fine, only issue left is the dlopen (only!) on the physical iPhone device.

from injectioniii.

arthurschiller avatar arthurschiller commented on May 29, 2024

Interestingly enough, on the physical Vision Pro device I could load the iOSInjection bundle and it still worked. Probably similar enough ->

// Running on Real Device let resourceName: String #if os(macOS) || targetEnvironment(macCatalyst) resourceName = "macOSInjection" #elseif os(visionOS) resourceName = "iOSInjection" // seems to work without using xrOSInjection #else resourceName = "iOSInjection" #endif guard let bundlePath = Bundle.main.path(forResource: resourceName, ofType: "bundle"), let bundle = Bundle(path: bundlePath), bundle.load() else { fatalError() }

from injectioniii.

johnno1962 avatar johnno1962 commented on May 29, 2024

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.

from injectioniii.

arthurschiller avatar arthurschiller commented on May 29, 2024

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):
https://gist.github.com/arthurschiller/a4471129584d11e9b358d99bad4aa0dc

Yeah visionOS works totally fine :)
Video attached:
https://github.com/johnno1962/InjectionIII/assets/3637723/0d38006a-a4f2-49d0-b881-2582abc5c357

I can try it maybe with another iPhone.

from injectioniii.

arthurschiller avatar arthurschiller commented on May 29, 2024

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 :)

from injectioniii.

johnno1962 avatar johnno1962 commented on May 29, 2024

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!)

from injectioniii.

arthurschiller avatar arthurschiller commented on May 29, 2024

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! :)

from injectioniii.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.