johnno1962 / injectionforxcode

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

Injection plugin connected but nothing gets injected #190

Closed dyang closed 7 years ago

dyang commented 7 years ago

Hi,

Thanks for the great tool!

I'm using the latest standalone injection app v1.2 (1). I manage to make it work in a simple demo app. However when I try to use it on my work project nothing gets injected. i.e. When I run the Inject source command, Xcode produces the following in its console and the injected method doesn't get called.

2017-01-03 21:54:52.197 fiPrivIphone[37253:987925] Injection attempting connection to: 127.0.0.1:31452 2017-01-03 21:54:52.198 fiPrivIphone[37253:987925] Connected to "Injection" plugin, ready to load x86_64 code.

When I check the console via View Console it's empty there.

I tried to switch on "automatically manage signing" in Xcode and select "None" as the team, but it didn't help.

Further more, if I run Bundle Project, I get the following message in the console. Not sure if this is relevant:

Connection from: /Users/dyang/Library/Developer/CoreSimulator/Devices/71076721-9475-440E-9835-65D49E265885/data/Containers/Bundle/Application/DEEA3C06-7B21-4611-AE37-1E2E9CA7D452/fiPrivIphone.app/fiPrivIphone x86_64 (16) 
The file /unknown/Logs/Build/../iOSInjectionProject/InjectionBundle.xcodeproj does not exist.

Are there other logs that I can check to see where things went wrong? Can someone please point me to the right direction?

Many thanks!

Xcode: 8.2.1 Injection: 1.2 (1)

johnno1962 commented 7 years ago

Interesting, it’s not found your project correctly hence the “/unknown". Do you have the project open in Xcode?

dyang commented 7 years ago

Yes I have the project open in Xcode. I also made sure that was the only Xcode project I opened. It's interesting that if I try this in a Hello World project on the same machine, then everything works.

johnno1962 commented 7 years ago

Do you have a section of text selected in the file being injected?

dyang commented 7 years ago

No, I didn't select any text.

johnno1962 commented 7 years ago

Can you select some so that it correctly identifies the file you want to inject? This is a limitation of using the AppleScript api.

johnno1962 commented 7 years ago

Other thing to check is whether you have a custom “Preferences/Locations” set for the project.

dyang commented 7 years ago

I selected some text in the edited file, saved the file and tried both the Inject source and Bundle project command but none of them seemed help.

dyang commented 7 years ago

Hmm, I have the default location unchanged.

dyang commented 7 years ago

Does it matter that I've installed the Xcode plugin version before? I've since removed the plugin from /Users/me/Library/Application Support/Developer/Shared/Xcode/Plug-ins.

johnno1962 commented 7 years ago

They should work side by side. I can TeamView if you want to get to the bottom of this.

dyang commented 7 years ago

That'll be super awesome! Many thanks! What do you need from me to get TeamView up and running? :)

johnno1962 commented 7 years ago

If you have TeamView installed email me your connection info to injection at johnholdsworth.com

johnno1962 commented 7 years ago

Problem was custom configuration names in the end. I’ve prepared a fix: v1.3 for this problem if you would like to re-download and try again.

dyang commented 7 years ago

Many thanks for the fix! It works like a charm :)