johnno1962 / InjectionIII

Re-write of Injection for Xcode in (mostly) Swift
MIT License
4.08k stars 319 forks source link

Error loading, when using mac target #483

Closed Blejator90 closed 9 months ago

Blejator90 commented 9 months ago

Hi, I've tried using this with inject and both work fine on any iOS target projects. However, when target is mac I keep getting an error. Tried using fresh projects, and another device. Also tried installing InjectionIII manually & from the Appstore. I am getting the same issue.

Googling this error does not find too many results.

The error:

Error loading /Applications/InjectionIII.app/Contents/Resources/macOSInjection.bundle/Contents/MacOS/macOSInjection (101): dlopen(/Applications/InjectionIII.app/Contents/Resources/macOSInjection.bundle/Contents/MacOS/macOSInjection, 0x0109): tried: '/Users/nebojsanadj/Library/Developer/Xcode/DerivedData/watch-run-demo-csvbpnkbjgoiydcprhqdwdslluqi/Build/Products/Debug/macOSInjection' (no such file), '/usr/lib/system/introspection/macOSInjection' (no such file, not in dyld cache), '/Applications/InjectionIII.app/Contents/Resources/macOSInjection.bundle/Contents/MacOS/macOSInjection' (code signature in '/Applications/InjectionIII.app/Contents/Resources/macOSInjection.bundle/Contents/MacOS/macOSInjection' not valid for use in process: mapping process and mapped file (non-platform) have different Team IDs), '/System/Volumes/Preboot/Cryptexes/OS/Applications/InjectionIII.app/Contents/Resources/macOSInjection.bundle/Contents/MacOS/macOSInjection' (no such file), '/Applications/InjectionIII.app/Contents/Resources/macOSInjection.bundle/Contents/MacOS/macOSInjection' (code signature in '/Applications/InjectionIII.app/Contents/Resources/macOSInjection.bundle/Contents/MacOS/macOSInjection' not valid for use in process: mapping process and mapped file (non-platform) have different Team IDs)

Did I miss something from the docs? Is there some extra step when configuring injection for macOS? XCode 15.2 macOS 14.2.1

Thanks

johnno1962 commented 9 months ago

Hi, This is a codesigning issue. The easiest way to avoid this is to add a build phase with the new copy_bundle.sh script (If you are using one of the GitHub binary releases) then the injection bundle should get signed with your app. See the instructions for injecting on an iOS device.

Blejator90 commented 9 months ago

Hi,

Ops, I missed that part. I used the iOS injection for some time, and it always worked magically, I got confused.

All good, and thank you!

johnno1962 commented 9 months ago

np, I've updated the README for injecting a macOS app. Thee copy_bundle.sh is a recent development.