injectionforxcode icon indicating copy to clipboard operation
injectionforxcode copied to clipboard

😂 How to install in xcode 8?

Open ghost opened this issue 9 years ago • 42 comments

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

ghost avatar Sep 28 '16 03:09 ghost

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

objczl avatar Sep 28 '16 08:09 objczl

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 ([email protected]), giving this error message and the time and date of the error.

dollar2048 avatar Sep 28 '16 12:09 dollar2048

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 “InjectionLoader” used in “unlatched” 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 “patched” injection using a main.m file. If you still can’t get it to work please provide more detail of your problem than “it doesn’t work”. How doesn’t it work? What is the error? Is the plugin loading?

johnno1962 avatar Sep 28 '16 13:09 johnno1962

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

`

** RECORDED BUILD SUCCEEDED ** 

Renaming bundle so it reloads..
rm -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"
Codesigning with identity 'iPhone Developer' for iOS device
 iPhone Developer: ambiguous (matches "iPhone Developer: User (N3YZ6Z6Z3X)" and "iPhone Developer: [email protected] (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 ***`

dollar2048 avatar Sep 28 '16 13:09 dollar2048

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)

johnno1962 avatar Sep 28 '16 13:09 johnno1962

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

dollar2048 avatar Sep 28 '16 17:09 dollar2048

Please see https://github.com/johnno1962/injectionforxcode/issues/41

johnno1962 avatar Sep 28 '16 19:09 johnno1962

@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.

dollar2048 avatar Sep 29 '16 07:09 dollar2048

@dollar2048 This is my issue ...

ghost avatar Sep 29 '16 07:09 ghost

@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)

dollar2048 avatar Sep 29 '16 08:09 dollar2048

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

ghost avatar Sep 29 '16 08:09 ghost

@luoerming

  1. so did you unsign xcode8?
  2. try to install "injection" via alcatraz and not via xcodebuild.

dollar2048 avatar Sep 29 '16 08:09 dollar2048

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

qq20160929-0 2x qq20160929-0 2x

ghost avatar Sep 29 '16 08:09 ghost

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'

ghost avatar Sep 29 '16 08:09 ghost

@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?

dollar2048 avatar Sep 29 '16 09:09 dollar2048

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.

ghost avatar Sep 29 '16 10:09 ghost

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

dollar2048 avatar Sep 29 '16 12:09 dollar2048

@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'

ghost avatar Sep 29 '16 12:09 ghost

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

dollar2048 avatar Sep 29 '16 13:09 dollar2048

@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.

ghost avatar Sep 29 '16 13:09 ghost

Sorry, than we have to ask @johnno1962

dollar2048 avatar Sep 29 '16 13:09 dollar2048

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

ghost avatar Sep 29 '16 14:09 ghost

It’s best to build the plugin from source rather than using Alcatraz now. The “InjectionLoader” 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.

johnno1962 avatar Sep 29 '16 14:09 johnno1962

@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

ghost avatar Sep 29 '16 14:09 ghost

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

ghost avatar Sep 29 '16 14:09 ghost

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’t see why it can’t 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.

johnno1962 avatar Sep 29 '16 14:09 johnno1962

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

dollar2048 avatar Sep 29 '16 14:09 dollar2048

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

johnno1962 avatar Sep 29 '16 14:09 johnno1962

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

dollar2048 avatar Sep 29 '16 19:09 dollar2048

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: [email protected] (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: [email protected] (43173B53US)"

johnno1962 avatar Sep 29 '16 19:09 johnno1962

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

johnno1962 avatar Sep 29 '16 20:09 johnno1962

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

dollar2048 avatar Sep 30 '16 07:09 dollar2048

Hurrah! But does it work now?

johnno1962 avatar Sep 30 '16 15:09 johnno1962

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

dollar2048 avatar Sep 30 '16 15:09 dollar2048

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

johnno1962 avatar Sep 30 '16 15:09 johnno1962

I’ll leave this open for other users.

johnno1962 avatar Sep 30 '16 15:09 johnno1962

@johnno1962 Thanks anyway! this plugin is so nice.

dollar2048 avatar Sep 30 '16 15:09 dollar2048

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

johnno1962 avatar Oct 03 '16 19:10 johnno1962

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.

ivnsch avatar Oct 05 '16 18:10 ivnsch

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

ghost avatar Oct 08 '16 02:10 ghost

You can now avoid all this by using the new standalone Injection as an App. http://johnholdsworth.com/injection.html

johnno1962 avatar Feb 27 '17 15:02 johnno1962

@johnno1962 Wow, It's very cool new features, I can finally use this plugin Now!! But I still have an error code.

Like this: 1 warning generated. objc[76145]: Class BTBicycViewController is implemented in both /Users/xx/Library/Developer/CoreSimulator/Devices/EE0BB85E-98CF-4E4C-9B15-41CE0E6014F6/data/Containers/Bundle/Application/A8EDC737-112C-4AC7-BB43-FE169F0564BC/xx.app/xx (0x11069f7e0) and /Users/xx/Library/Developer/Xcode/DerivedData/biketo-dnylhyikwfqriaegbrpmsayzjwmh/Logs/iOSInjectionProject/build/Debug-iphonesimulator/InjectionBundle6.bundle/InjectionBundle (0x1289017c0). One of the two will be used. Which one is undefined.

ghost avatar Feb 28 '17 03:02 ghost