injectionforxcode icon indicating copy to clipboard operation
injectionforxcode copied to clipboard

Code injection failed due to multiple certificates

Open johnvuko opened this issue 9 years ago • 18 comments

Hi, I cannot inject code. I installed the plugin by cloning the git and built it with xcode (6.3 last version).

When I launch my app I see:

+[BundleInjection load] 127.0.0.1
Injection attempting connection to: 127.0.0.1:31442 (see project's main.(m|mm)
Injection attempting connection to: 192.168.1.104:31442 (see project's main.(m|mm)
Connected to "Injection" plugin, ready to load arm64 code.
Param #0 -> 1.000000
Param #1 -> 1.000000
Param #2 -> 1.000000
Param #3 -> 1.000000
Param #4 -> 1.000000
Color #0 -> 0.000000,0.000000,0.000000,1.000000
Color #1 -> 1.000000,0.000000,0.000000,1.000000
Color #2 -> 0.000000,1.000000,0.000000,1.000000
Color #3 -> 0.058130,0.055542,1.000000,1.000000
Color #4 -> 1.000000,1.000000,1.000000,1.000000

So I supposed the project is ready for injection. But when I want to inject some code, I have got this error:


** RECORDED BUILD SUCCEEDED **


Renaming bundle so it reloads..

rm -rf “/Users/jonathan/Desktop/Codage/EIVO/Moods/iOSInjectionProject/build/Debug-iphoneos/InjectionBundle3.bundle” && cp -r “/Users/jonathan/Desktop/Codage/EIVO/Moods/iOSInjectionProject/build/Debug-iphoneos/InjectionBundle.bundle” “/Users/jonathan/Desktop/Codage/EIVO/Moods/iOSInjectionProject/build/Debug-iphoneos/InjectionBundle3.bundle”

Codesigning with identity ‘iPhone Developer’ for iOS device

iPhone Developer: ambiguous (matches “iPhone Developer: Jonathan Tribouharet (T4N37HB354)” and “iPhone Developer: Jonathan Tribouharet (Q8YU37NSUJ)” in /Users/jonathan/Library/Keychains/login.keychain)

Could not codesign as ‘iPhone Developer’: /Users/jonathan/Desktop/Codage/EIVO/Moods/iOSInjectionProject/build/Debug-iphoneos/InjectionBundle3.bundle at /Users/jonathan/Library/Application Support/Developer/Shared/Xcode/Plug-ins/InjectionPlugin.xcplugin/Contents/Resources/common.pm line 51.

main::error(‘Could not codesign as 9hone Developerø/Users/jonathan/D…’) called at /Users/jonathan/Library/Application Support/Developer/Shared/Xcode/Plug-ins/InjectionPlugin.xcplugin/Contents/Resources/injectSource.pl line 422

*** Bundle build failed ***

Check Bundle project.


I supposed the bug is because I have multiple certificate (multiple teams on, one personal (developer), one entreprise, and others from my clients) and codesigndon't know which one choose. I don't know if you indicate to codesign to use the same certificate I use for building my app with xcode.

johnvuko avatar Apr 17 '15 19:04 johnvuko

HI, you’re nearly there. Use "Product/<ProjectName>/Open Bundle” to open the bundle project inside which you can select the specific identity. This value is cached in a file <project_root>/isoInjectionProject//identiy.txt. delete it so it gets refreshed. The value in that file is that passed to codesign on the command line.

johnno1962 avatar Apr 17 '15 20:04 johnno1962

OK thanks. Maybe you could add this in the documentation.

johnvuko avatar Apr 17 '15 22:04 johnvuko

I had to specify the specific signing certificate in the bundle project and put the full name of my signing certificate in identity.txt - i.e. "iPhone Developer: My Name (XX4XXXXX64)" to get it to work.

troya2 avatar Nov 18 '15 19:11 troya2

WonderFul Solution, Recommending mention this in README.md, I spent a lot of time to solve this problem.

oit63 avatar Dec 10 '15 04:12 oit63

I was just about to fix this and it seems this is resolved in Xcode 7.2 GM as the CODE_SIGN_IDENTITY now contains the (XX4XXXXX64) section. Let me know if you still have dificulties after deleteing the iOSInjectionProject/arm64/identity.txt file.

johnno1962 avatar Dec 12 '15 20:12 johnno1962

Thanks, I would upgrade Xcode to the latest version in two days. And deleting the identity.txt cannot solve it, instead adding signing certificate in identity.txt - i.e. "iPhone Developer: My Name (XX4XXXXX64)" does for me.

oit63 avatar Dec 13 '15 01:12 oit63

thanks for @johnno1962 providing such an genius plugin!!! I run this in simulator, but when it comes to my iPhone device, I received the same problem with @jonathantribouharet ,then as you suggested, I deleted the iOSInjectionProject/arm64/identity.txt file.but it still pops the same problem(ambiguous code identity...). Finally I have to delete other "iPhone Developer" certificates in login KeyChain to leave only one certificate, as a result it worked for my iPhone device. But I am confused, since xcode7.2 it allows us to debug with Xcode automatically generating provisioning files for us, why I have to delete other certificates to leave only one?

zltunes avatar Dec 20 '15 14:12 zltunes

blew is my problem:

Codesigning with identity 'iPhone Developer' for iOS device
iPhone Developer: ambiguous (matches "iPhone Developer: Name1 (354A2HDVR5)" and "iPhone Developer: Name2 (68X4N6DQ2C)" in /Users/Leon/Library/Keychains/login.keychain)

*** Could not codesign as 'iPhone Developer': /Users/Leon/Documents/iOS_studyDemos/learn_MJExtension/iOSInjectionProject/build/Debug-iphoneos/InjectionBundle2.bundle **_

 at /Users/Leon/Library/Application Support/Developer/Shared/Xcode/Plug-ins/InjectionPlugin.xcplugin/Contents/Resources/common.pm line 55.
 main::error('Could not codesign as 9hone Developerø/Users/Leon/Docum...') called at /Users/Leon/Library/Application Support/Developer/Shared/Xcode/Plug-ins/InjectionPlugin.xcplugin/Contents/Resources/injectSource.pl line 493
**_ Bundle build failed ***

zltunes avatar Dec 20 '15 14:12 zltunes

As we discuss above, This problem can be solved by edit the file iOSInjectionProject/arm64/identity.txt file

oit63 avatar Dec 22 '15 14:12 oit63

do not delete it, you should modify the last line As troya2 said that :+1: put the full name of my signing certificate in identity.txt - i.e. "iPhone Developer: My Name (XX4XXXXX64)" to get it to work. iOSInjectionProject/x86_64/identity.txt file

oit63 avatar Dec 22 '15 14:12 oit63

unfortunately, I recent change to realm which does not support injection.

oit63 avatar Dec 22 '15 14:12 oit63

Realm also Support Injection Now, and I am back for Injection, :+1:

oit63 avatar Mar 31 '16 08:03 oit63

SomeTimes it need to delete the same name identity in the keychain. Hoping to make a default chose, or a choice options.

oit63 avatar Mar 31 '16 08:03 oit63

Hello, since I have multiple signing identities I manually specified required identity in iOSInjectionProject/arm64/identity.txt

Anyway, I see this error when I try to inject changes: 
iPhone Developer: Sergey Petrov (ID): ambiguous (matches "iPhone Developer: Sergey Petrov (ID)" in /Library/Keychains/System.keychain and "iPhone Developer: Sergey Petrov (ID)" in /Users/pr0ger/Library/Keychains/login.keychain)
 Of course, I checked system keychain and didn't find any traces of duplicate of my signing identity there. What can I miss?

Pr0Ger avatar Jul 08 '16 13:07 Pr0Ger

I’m afraid I don’t know. Try the sodesigning command from the command line and work from there.

johnno1962 avatar Jul 08 '16 13:07 johnno1962

thanks, I solve this problem last year.

oit63 avatar Aug 03 '16 10:08 oit63

Hi I am still facing this problem. but not find out any solution for this. I am using Xcode 9.3. So can anyone please suggest me what should I do.

jonyMIND avatar Jun 15 '18 12:06 jonyMIND

Please try the new App store Version of the App https://itunes.apple.com/us/app/injectioniii/id1380446739?ls=1&mt=12

johnno1962 avatar Jun 15 '18 16:06 johnno1962