馃槀 How to install in xcode 8? #171

Open
luoerming opened this Issue Sep 28, 2016 · 40 comments

Projects

None yet

5 participants

@luoerming
luoerming commented Sep 28, 2016 edited

How to install in Xcode 8. Please give a detailed tutorial. I tried many times or failed.

@objczl
objczl commented Sep 28, 2016

+1 I tried un-sign Xcode but it still can't work.

@dollar2048

Software error:

Could not connect Access denied for user 'johnhol_inject'@'localhost' (using password: YES) at ../../../injection/common.pm line 13.
Compilation failed in require at sale.cgi line 4.
BEGIN failed--compilation aborted at sale.cgi line 4.
For help, please send mail to the webmaster (webmaster@injection.johnholdsworth.com), giving this error message and the time and date of the error.

@johnno1962
Owner

There are a number of new hurdles Xcode 8 puts up. The first thing to check is that the plugin has built without error and is loading into Xcode. Is there a Product/Injection Plugin menu item inside Xcode? If this is not present you need to unsign Xcode as described elsewhere. The second problem is that the 鈥淚njectionLoader鈥 used in 鈥渦nlatched鈥 injection now needs to be codesigned before it can load into the simulator. Signing this is part of the injection plugin build and typical problems include invalid or duplicate codesigning identities. Check for errors when you build. If these two conditions are met injection should work. If there is a Project/Injection Plugin menu item but the Loader does not load giving an error in the console, try 鈥減atched鈥 injection using a main.m file. If you still can鈥檛 get it to work please provide more detail of your problem than 鈥渋t doesn鈥檛 work鈥. How doesn鈥檛 it work? What is the error? Is the plugin loading?

@dollar2048

@johnno1962 xcode is unsigned.
"injection menu" is visible.
I have installed in using Alcatraz.
but now It gives me error:

`鈥ㄢ** RECORDED BUILD SUCCEEDED **
鈥ㄢ≧enaming bundle so it reloads..鈥╮m -rf "/Users/user/PR/Project/iOSInjectionProject/build/Debug-iphonesimulator/InjectionBundle1.bundle" && cp -r "/Users/user/PR/Project/iOSInjectionProject/build/Debug-iphonesimulator/InjectionBundle.bundle" "/Users/user/PR/Project/iOSInjectionProject/build/Debug-iphonesimulator/InjectionBundle1.bundle"鈥–odesigning with identity 'iPhone Developer' for iOS device鈥
iPhone Developer: ambiguous (matches "iPhone Developer: User (N3YZ6Z6Z3X)" and "iPhone Developer: user123@gmail.com (43173B53US)" in /Users/user/Library/Keychains/login.keychain)

鈥ㄢ*** Could not codesign as 'iPhone Developer': /Users/user/PR/Project/iOSInjectionProject/build/Debug-iphonesimulator/InjectionBundle1.bundle ***鈥ㄢ

at /Users/user/Library/Application Support/Developer/Shared/Xcode/Plug-ins/InjectionPlugin.xcplugin/Contents/Resources/common.pm line 57.鈥

main::error('Could not codesign as 9hone Developer酶/Users/user...') called at /Users/user/Library/Application Support/Developer/Shared/Xcode/Plug-ins/InjectionPlugin.xcplugin/Contents/Resources/injectSource.pl line 513鈥
*** Bundle build failed ***`

@johnno1962
Owner
johnno1962 commented Sep 28, 2016 edited

You need to resolve the ambiguity in the injection bundle project. Open Project/Injection Bundle/Open Bundle Project and modify code signing identity and delete iOSInjectionProject/identity.txt so it is updated (edited)

@dollar2048

@johnno1962
sorry, where do I have to modify? in iOSInjectionProject which is in my project?
there I see "Target is unsigned"

@johnno1962
Owner

Please see #41

@dollar2048

@johnno1962 thanks for the great help!!!
finally I have to delete other "iPhone Developer" certificates in login KeyChain to leave only one certificate.
this issue could be closed, I think.

@luoerming

@dollar2048 This is my issue ...

@dollar2048
dollar2048 commented Sep 29, 2016 edited

@luoerming I have used three lines to unsign Xcode 8 and update plugins:
sudo gem install update_xcode_plugins
update_xcode_plugins --unsign
update_xcode_plugins

from Here (unsign Xcode8)

@luoerming
luoerming commented Sep 29, 2016 edited

cd InjectionLoader && xcodebuild -sdk iphonesimulator -config Debug && cd - && chmod +x "$INSTALL_DIR/$UNLOCALIZED_RESOURCES_FOLDER_PATH"/*.pl && cp -rf Classes/Xtrace.* InjectionLoader/build/*-iphonesimulator/InjectionLoader.bundle "$INSTALL_DIR/$UNLOCALIZED_RESOURCES_FOLDER_PATH" /usr/bin/codesign --force --sign "iPhone Developer" --timestamp=none "$INSTALL_DIR/$UNLOCALIZED_RESOURCES_FOLDER_PATH"/InjectionLoader.bundle

qq20160923-1 2x

@dollar2048 Thank you, This is my "Run Script" code, There is something wrong here锛

I have a error code,
2

@dollar2048

@luoerming

  1. so did you unsign xcode8?
  2. try to install "injection" via alcatraz and not via xcodebuild.
@luoerming
luoerming commented Sep 29, 2016 edited

@dollar2048
Yes, I was using alcatraz installed, But I have a new error. 馃様

qq20160929-0 2x

qq20160929-0 2x

@luoerming
luoerming commented Sep 29, 2016 edited

qq20160929-2 2x

I try using Alcatraz to reinstall again. I still can not succeed.


qq20160929-1 2x

Then I restart the Xcode. And choose the "load Bundle " button, Now the "injection menu" is visible. But when I run the injection plug-in I have a new error code.

2016-09-29 17:12:47.437 example[50417:872947] Error loading /Users/carroll/Library/Application Support/Developer/Shared/Xcode/Plug-ins/InjectionPlugin.xcplugin/Contents/Resources/InjectionLoader.bundle/InjectionLoader: dlopen(/Users/carroll/Library/Application Support/Developer/Shared/Xcode/Plug-ins/InjectionPlugin.xcplugin/Contents/Resources/InjectionLoader.bundle/InjectionLoader, 265): no suitable image found. Did find: /Users/carroll/Library/Application Support/Developer/Shared/Xcode/Plug-ins/InjectionPlugin.xcplugin/Contents/Resources/InjectionLoader.bundle/InjectionLoader: required code signature missing for '/Users/carroll/Library/Application Support/Developer/Shared/Xcode/Plug-ins/InjectionPlugin.xcplugin/Contents/Resources/InjectionLoader.bundle/InjectionLoader'

@dollar2048

@luoerming I have received also error 65 and it installed fine for me anyway.
then I have Click OK and relauch XCode.
XCode asked me to "Load plugin bundle".
after that I can see Injection in my "Product" menu tab.

do you see Injection as installed plugin in your package manager?

@luoerming
luoerming commented Sep 29, 2016 edited

qq20160929-3 2x

qq20160929-3 2x

Yes, I'm sure it's already installed to Xcode8. And the Xcode menu is visible injection plug-in button.

@dollar2048

@luoerming so you did install it in Xcode 8!
the problem is solved, isn't it? ))

@luoerming

@dollar2048 馃槳Yes, Is already installed, But it can not work. This is error code .

2016-09-29 17:12:47.437 example[50417:872947] Error loading /Users/carroll/Library/Application Support/Developer/Shared/Xcode/Plug-ins/InjectionPlugin.xcplugin/Contents/Resources/InjectionLoader.bundle/InjectionLoader: dlopen(/Users/carroll/Library/Application Support/Developer/Shared/Xcode/Plug-ins/InjectionPlugin.xcplugin/Contents/Resources/InjectionLoader.bundle/InjectionLoader, 265): no suitable image found. Did find: /Users/carroll/Library/Application Support/Developer/Shared/Xcode/Plug-ins/InjectionPlugin.xcplugin/Contents/Resources/InjectionLoader.bundle/InjectionLoader: required code signature missing for '/Users/carroll/Library/Application Support/Developer/Shared/Xcode/Plug-ins/InjectionPlugin.xcplugin/Contents/Resources/InjectionLoader.bundle/InjectionLoader'

@dollar2048

@luoerming You have this error in the installation window. right?
but the plugin was installed. right?
try to use it.

@luoerming
luoerming commented Sep 29, 2016 edited

@dollar2048 Thank you. It's indeed already installed in Xcode. But when I tried to run it. The Xcode console will be display this error code.

@dollar2048

Sorry, than we have to ask @johnno1962

@luoerming

@dollar2048 Anyway, Thank you. Can I make a friend with you?

@johnno1962
Owner

It鈥檚 best to build the plugin from source rather than using Alcatraz now. The 鈥淚njectionLoader鈥 error you are getting is becuase it is not codesigned whcih is done in the RunScript build phase you mention above. That is the place to look.

@luoerming

@johnno1962 But when I paste the RunScript. Xcode will not run.

This is RunScript code and Xcode console displayed error code

qq20160923-1 2x


2

@luoerming

@johnno1962 So this is because I did not give the signature of the injection plug-in?

@johnno1962
Owner
johnno1962 commented Sep 29, 2016 edited

The injection plugin itself does not need to be signed. It is the InjectionLoader which loads into the simulator on demand when you inject that needs to be signed with Xcode 8. I don鈥檛 see why it can鈥檛 find the InjectionLoader directory. it should be there if you have git cloned the repo correctly. But your problem is still ambiguous codesigning. Change "iPhone developer" in the run script to something else.

@dollar2048

@johnno1962 by the way I have the same issue when try to compile "Injection" by cloning the project.

@johnno1962
Owner
johnno1962 commented Sep 29, 2016 edited

which specific issue? Codesigning issues are related to the keys in your keychain.

@dollar2048

Yes. the same error in the RunScript. Related to Code signing. (that is why I could install only via Alcatraz)

@johnno1962
Owner

Alcatraz is just ignoring what is an important error. If your error is still something like:
iPhone Developer: ambiguous (matches "iPhone Developer: User (N3YZ6Z6Z3X)" and "iPhone Developer: user123@gmail.com (43173B53US)" in /Users/user/Library/Keychains/login.keychain)

you need to alter the run script so it has a unique identity to sign with. Either "iPhone Developer: User (N3YZ6Z6Z3X)鈥 or "iPhone Developer: user123@gmail.com (43173B53US)"

@johnno1962
Owner
johnno1962 commented Sep 29, 2016 edited

i.e. alter this:
/usr/bin/codesign --force --sign "iPhone Developer" --timestamp=none "$INSTALL_DIR/$UNLOCALIZED_RESOURCES_FOLDER_PATH鈥/InjectionLoader.bundle

@dollar2048

@johnno1962 after deleting other "iPhone Developer" certificates in login KeyChain it builds with no error. I left only one certificate. :)

@johnno1962
Owner

Hurrah! But does it work now?

@dollar2048

@johnno1962 as for me, it started to work after installing via Alcatraz.

@johnno1962
Owner

Cool. I wish there was a solution to this amiguous signing problem other than deleteing profiles.

@johnno1962
Owner

I鈥檒l leave this open for other users.

@dollar2048

@johnno1962 Thanks anyway! this plugin is so nice.

@johnno1962
Owner

For more information look here: https://johntmcintosh.com/blog/2016/10/03/code-injection-ios

@i-schuetz
i-schuetz commented Oct 5, 2016 edited

I did all the steps from the blog, it's not working. The plugin seems to be installed - the additional menu items in XCode are available but the injected() function is not being called. I added it to a view controller which I use. Not sure if it's a general problem with the plugins - I also tried to install XcodeColors (via Alcatraz, installation of which worked without problems after unsigning XCode), it installed fine, it shows it's installed, I restarted XCode but the messages are not colored.

@luoerming

@johnno1962 Thanks anyway! this plugin is so nice. and I have solved this problem. Thank you very much.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment