johnno1962 / InjectionIII

Re-write of Injection for Xcode in (mostly) Swift
MIT License
3.96k stars 312 forks source link

Update to Swift 5.0 Xcode 10.2 #118

Closed Senocico closed 4 years ago

Senocico commented 5 years ago

I recently updated my project to Swift 5.0, Xcode 10.2 and seems that InjectionIII is not working anymore. It is possible to fix this for the latest version of Swift and Xcode? Thanks

zenangst commented 5 years ago

Hey @Senocico, we aim to release a new version later today. Stay tuned!

Senocico commented 5 years ago

@zenangst Thank you for your prompt and quickly answer!

xerdink commented 5 years ago

@zenangst I am waiting impatiently for this release!

zenangst commented 5 years ago

Thanks for your patience @Senocico @orhaneee; I've yet to release the version but you can download the binary here - https://github.com/johnno1962/InjectionIII/releases/download/1.5/InjectionIII.zip

Did some testing myself and everything seems to be in order, please take it for a spin.

ivkis commented 5 years ago

Hey, after updating xСode to 10.2, an error occurs in the console 💉 Could not locate storyboard compile What is the reason?

wangchou commented 5 years ago

Thanks for the quick update but

I found old class is not replaced by new class. (App Store Version for XCode 10.2, tested in Mojave 10.14.4)

Steps:

1) Create a new single view app and update AppDelegate (Swift 5) 2) Edit ViewController to

3) Launch the app 4) Select the project folder for watching 5) Edit the "old class" to "new class". 6) Save the file

The console shows it injected successfully. (with some duplicate class warning like before)

But the class behaves like old class. (not printing "new class")

Does anyone meet the same issue? I also built the master branch but met some error in run script phrase~

zenangst commented 5 years ago

Hey @wangchou, I've seen some varied results when using the new version of InjectionIII. For the most part, it does work as intended, I'm unsure what has changed in the latest version of Swift to get these side-effects where it opts out. I'm doing some research on the issue but thus far I haven't been able to find the source for the issue.

To build master, you'll need the previous version of Xcode installed because it creates two separate injection bundles per platform.

You can installed Xcode 10.1 using https://github.com/xcpretty/xcode-install. Make sure that the version is called Xcode101.app and is located in /Applications.

/Applications/Xcode101.app

Let me know how it goes, cheers!

wangchou commented 5 years ago

@zenangst

I tried the iOS 12.1 Simulator and it works. (App Store Version InjectionIII + XCode 10.2 + Swift 5 + iOS 12.1)

IOS 12.2 Simulator is not working. 😢 (for both Swift 4.2 and Swift 5 ) But it's ok for me to keep working on app. 🔥

PS: Download old version simulators via XCode -> Preferences... -> Components (about 2.5GB)

zenangst commented 5 years ago

@wangchou interesting, it seems to be working for me with the latest version of the simulator. What kind of error are you seeing? Is it that the bundle cannot be loaded properly or is it that injections simply don't work as intended?

wangchou commented 5 years ago

@zenangst use the code below. After launching do

Edit the string from "old class" to "asdfg". And Save File

both will show similar injected message but

--- With iOS Simulator 12.1, it prints "asdfg" --- With iOS Simulator 12.2, it prints "old class"

zenangst commented 5 years ago

I tried something similar just now:

I tried Xcode 12.2, Swift 5 in a brand new project under iOS using the iOS 12.2 simulator.

PastedGraphic-1
xerdink commented 5 years ago

I am still receiving Symbol not found: _$SBOWV, any idea why this occurs?

zenangst commented 5 years ago

@orhaneee which bundle are you trying to load?

xerdink commented 5 years ago
Error loading /Applications/InjectionIII.app/Contents/Resources/iOSInjection10.bundle/iOSInjection10:  dlopen(/Applications/InjectionIII.app/Contents/Resources/iOSInjection10.bundle/iOSInjection10, 265): Symbol not found: _$SBOWV
  Referenced from: /Applications/InjectionIII.app/Contents/Resources/iOSInjection10.bundle/iOSInjection10
  Expected in: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/swift/libswiftCore.dylib
 in /Applications/InjectionIII.app/Contents/Resources/iOSInjection10.bundle/iOSInjection10

@zenangst iOSInjection10 btw.

Senocico commented 5 years ago

I receive the following error in Xcode 10.2 💉 *** Could not locate storyboard compile ***

wangchou commented 5 years ago

@zenangst interesting. I did see blue screen. But the it also print "old class" in iOS 12.2 Simulator. スクリーンショット 0031-03-27 20 07 43

zenangst commented 5 years ago

@orhaneee If you are using Xcode 12.2, you should load the version without the number attached to it. Try it out and see what that gives you.

Bundle(path: "/Applications/InjectionIII.app/Contents/Resources/iOSInjection.bundle")?.load()
zenangst commented 5 years ago

@wangchou thanks for the update, been seeing the same things actually but thanks for confirming. We are investigating the issue, might be some patterns that no longer match as they did before.

xerdink commented 5 years ago

@zenangst it is working now.. thank you.

zenangst commented 5 years ago

@wangchou @orhaneee @Senocico small update on the issue. Apple threw us some curveballs with the latest release so we need to adapt to those changes. We've started testing now and things are starting to look good. I'll keep you posted when we have more updates on the issue.

The issue I'm referring to is the thing that @wangchou is seeing where changing functions have no effect.

zenangst commented 5 years ago

So far everything looks good, we will do more testing and if everything looks okay a new version should arrive later today. A developer signed version will be posted on GitHub and a new version will be sent into the Mac App Store.

zenangst commented 5 years ago

Getting closer now, here is the PR #120

zenangst commented 5 years ago

@wangchou @orhaneee @Senocico 1.5.1 is now available for direct download - https://github.com/johnno1962/InjectionIII/releases/tag/1.5.1

Senocico commented 5 years ago

💉 *** Could not locate storyboard compile ***

I receive this console warning when I do some storyboard changes and I (re)build the project. What should I do to get rid of this?

zenangst commented 5 years ago

@Senocico mind making another issue for this, it would be great if you could supply a demo project to be able to replicate the issue. Note that storyboard injection is very unpredictable

References
Senocico commented 5 years ago

EnglishAttack.zip - Xcode 10.2

Here you can find a demo project. Go to Home.storyboard, do some changes, save them or build the project. The same results: 💉 Could not locate storyboard compile

johnno1962 commented 5 years ago

Thanks for the test project @Senocio, looks like the storyboard injection feature is broken for Xcode 10.2 and will need some TLC. If it’s not a silly question were you very dependant on it?

Senocico commented 5 years ago

At this point I'm not really dependant on it, but I like to work with this tool because is development saving time. I really appreciate your work and sure there are many others that are using Injection tool for the same reason.

johnno1962 commented 5 years ago

But for storyboard injection specifically were you finding it particularly useful or a “nice to have”.

Senocico commented 5 years ago

When I presenting a new view controller that has its own storyboard and then present / push another view controller, and so on for many controllers with their own storyboard and it takes time to run the project again to get to the last view controller to see the changes made to its storyboard, with this Injection tool I only re-build the project and present it again (after dismiss / pop the last controller) without having to run the project again from the beginning...

dfmarulanda commented 5 years ago

I have the storyboard injection issue. Any ideas on a workaround?

johnno1962 commented 5 years ago

Hi, I'm afraid it's broken at the moment due to changes in 10.2

DanBurkhardt commented 5 years ago

But for storyboard injection specifically were you finding it particularly useful or a “nice to have”.

I can say that for me, being almost entirely reliant upon .xib, lack of ability to inject storyboard makes it almost useless for UI implementation, which is when I need it the most :(

Any time table for a fix? Need help?

johnno1962 commented 5 years ago

I'll take a look.

johnno1962 commented 5 years ago

@zenangst has rolled a new version of InjectionIII that should inject storyboards with Xcode 10.2:

https://github.com/johnno1962/InjectionIII/releases/tag/1.5.2

DanBurkhardt commented 5 years ago

@zenangst has rolled a new version of InjectionIII that should inject storyboards with Xcode 10.2:

https://github.com/johnno1962/InjectionIII/releases/tag/1.5.2

Excellent! Great thanks, and great work! Who / where can I donate to for this tool? Great work deserves appreciation, let me buy you dinner!