johnno1962 / injectionforxcode

Runtime Code Injection for Objective-C & Swift
MIT License
6.55k stars 565 forks source link

Error loading injection bundle #218

Closed proactive-solutions closed 6 years ago

proactive-solutions commented 6 years ago

Many many thanks for such a great tool.

I am facing below issue while trying to inject source code with FileWatcher and Ctrl+= shortcut.

It says "Library not loaded: @rpath/XCTest.framework/libswiftXCTest.dylib .... Reason: image not found"

I have checked the library libswiftXCTest.dylib is available at the path. I have tried deleting app and cleaning derived data, and reinstalling Injection App.

Can you please help me fix it?

Thanks for your time and effort.

Error loading /Users/pawansharma/Library/Developer/Xcode/DerivedData/UnityBound-gkfkkzciixvlwhcuewuphnifawbu/Logs/iOSInjectionProject/build/Debug-iphonesimulator/InjectionBundle17.bundle/InjectionBundle: dlopen(/Users/pawansharma/Library/Developer/Xcode/DerivedData/UnityBound-gkfkkzciixvlwhcuewuphnifawbu/Logs/iOSInjectionProject/build/Debug-iphonesimulator/InjectionBundle17.bundle/InjectionBundle, 265): Library not loaded: @rpath/XCTest.framework/XCTest Referenced from: /Users/pawansharma/Library/Developer/CoreSimulator/Devices/CE55CE68-3BEF-4398-BE10-06265C27A392/data/Containers/Bundle/Application/C87C4B9C-7152-4AD9-BDB8-F074F1AB4610/Unity Bound.app/Frameworks/libswiftXCTest.dylib Reason: image not found

screen shot 2017-07-14 at 11 51 21 pm

screen shot 2017-07-14 at 11 45 38 pm

johnno1962 commented 6 years ago

The image not found is "Library not loaded: .framework/XCTest” which seems strange. Send TeamViewer details to injection at john holdsworth.com if you’d like me to take a look at this.

proactive-solutions commented 6 years ago

Thanks a lot for the help, this is very kind of you. Willing to debug over team viewer.

I have sent you an email with my Team Viewer id and password.

Please do let me know you time zone. Mine is IST (UTC +5:30)

proactive-solutions commented 6 years ago

Extremely sorry to inform, but connecting over Team Viewer. I am attaching the complete error log. this might help.

I tried creating a new project it was working absolutely fine.

I used Carthage to build dependencies in my project that might be an issue.

Xcode_Injection_Error_Log.txt

screen shot 2017-10-04 at 11 09 17 pm

proactive-solutions commented 6 years ago

I downloaded again for Xcode 8.3.3 but no luck.

polac24 commented 6 years ago

Hi @proactive-solutions, I found out that your project is called "Unity Bound" (with a space character). Would it be possible to rename it (only to verify whether it actually is a reason) to "UnityBound" (with no space)?

At least, can you change a product name in Xcode: Build_Settings->Product Name? BTW. Please remember to clean a project after renaming...

proactive-solutions commented 6 years ago

hi @polac24 , Thanks for the tip, I tried but unfortunately not working for me. stuck after

cleaned derived data using finder and cmd + shift + option + k both options but still no luck.

"... First time learning of project, one second ..."

I am attaching the log are screenshot here for more details and my project settings screenshot. screen shot 2017-10-05 at 8 42 05 am screen shot 2017-10-05 at 8 42 20 am screen shot 2017-10-05 at 8 42 28 am

johnno1962 commented 6 years ago

Hi, It’s not finding “FBSDKCoreKit” according to the error. You need to edit the bundle project and add a framework search path.

polac24 commented 6 years ago

Hi @proactive-solutions , I was able to reproduce the same error after I intentionally changed a project configuration to not embed FBSDKCoreKit.framework: screen shot 2017-10-05 at 19 10 58

Moving it back to section "Embedded Binaries" solved a problem: screen shot 2017-10-05 at 19 13 11

proactive-solutions commented 6 years ago

I have added the framework search path and header search path in derived data folder framework and it did the job. Thanks a lot @johnno1962 @polac24 . You are awesome. But it gets deleted how can I set the path permanantly

polac24 commented 6 years ago

I think that your Framework Search Path should contain an entry with a directory from which you load FBSDKCoreKit.framework. I assume that you use compiled framework: either downloaded from the Internet or compiled using carthage.

You can check for FBSDKCoreKit.framework fullpath on Xcode: In ProjectNavigator(⌘+1) find it in the project tree, rightClick -> ShowFileInspector, Full Path in the right pane.

proactive-solutions commented 6 years ago

I have set full path for my framework folder which I built using Carthage in injection bundle project and now everything is working fine.