Closed johntmcintosh closed 7 years ago
Hi John, you’ve done well to get as far as you did getting injection working. There are a few issues with Xcode 8 most of which you’ve worked though:
You need to unsign Xcode and xcodebuild binaries. You need to codesign injection’s bundle and the on-demand loader for the simulator now. The bad access in ivar_getTypeEncodingSwift is to do with a new way Swift 3 represents types which affects the implementation of instance level “-injected" methods. Not sure what the issue is with Swift 2.3. I think I’ve been able to inject this end. Swift 3 certainly works.
I’m waiting until the smoke clears to decide what to do next. If Xcode continues to load plugins in it's final release version, I’ll release the new versions of the code I have offline in a branch and injection as is will have a future. If not I’ll need to come up with an out of process solution something like the “Injector” project perhaps using the “Smuggler” project if there is interest. Email me at injection at johnholdsworth.com and I can send you a snapshot of the new Xcode 8 code.
I'd certainly be interested in alternative solutions if things were to be more locked down in the final Xcode 8 release, but hopefully things will stay stable for now, and we'll get some additional official extension points before too long. We'll see...
@johnno1962 FYI - I confirmed this morning that the injection plugin (with both Swift 2.3 and Swift 3) is still working for me with the new beta 6.
Happy to hear it!
Just commenting with exact, quick steps to get injection working with Xcode 8 and the simulator:
if ( $isDevice )
-> if ( 1 )
identity.txt
for all architectures including x86_64Thanks Timothy. I’m planning to release a version as soon as XCode 8 GM comes out with these changes if things keep working as they do now.
Hi John,
What are you thinking in terms of "supporting" running in Xcode 8 in light of the new limitations around supported plugins? I wanted to see how far I could get, and was able to get an ObjC test project injecting successfully by doing the following:
InjectionPlugin
andInjectionBundle
project files to include my codesigning identity.injectSource.pl
script to apply codesigning for the simulator in addition to the device.After doing these steps, I was able to successfully inject into the ObjC project from Xcode 8 beta. However, I have run into a few issues:
injectSource.pl
are very basic and only support Xcode 8. For example, attempting the codesign for the simulator fails when trying to inject from Xcode 7. (I suspect it wouldn't be too difficult to make this more robust, but it would take me a little while to figure out how to expose the right information to the script.)Swift 2.3
When I attempt injection in the Swift 2.3 project from Xcode 8, the following is logged to the Xcode console:
and the following is logged to the Injection Console:
The message
cannot load image with wrong team ID in process using Library Validation
looks suspicious, but best I can tell I do have the signing setup correctly, so there's a chance that's a false alarm and that the "real" error isCould not locate compile command for /temp/InjectionDemo/InjectionDemo/ViewController.swift
.Swift 3
If I take the same swift demo project and run the conversion from Swift 2.3 to Swift 3 and then re-run, the following is logged to the Xcode 8 console:
And then we hit
EXC_BAD_ACCESS (code=1, address=0xffff...fffe9a0)
. The bad access appears to be in a function calledivar_getTypeEncodingSwift
called from-[NSObject(BundleSweeper) bsweep]
.Conclusion
So, with all that said... is this a route that's worth continuing to go down? Or should we consider moving to AppCode for continuing to use injection until we get enough "official" support in Xcode to be able to do this more properly?
(I apologize if this is really multiple separate issues. I'm not sure how much of what I'm running into is related to Xcode 8 plugin changes vs separate changes that need to be made to injection before Swift 2.3 or 3 are supported, unrelated to Xcode 8)
Thanks!