-
-
Notifications
You must be signed in to change notification settings - Fork 329
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Not working in Xcode 16 #520
Comments
What version of the app are you using? Github Releases 5.0.1 and above include the change required for Xcode 16. https://github.com/johnno1962/InjectionIII/releases |
I had the App Store version which was last updated 11mo ago. I installed latest version from Github and it's working now. |
I had the app store version and tried the latest from github and it still doesn't work |
Actually it's working on some views but on others that have @ObserveInjection var forceRedraw and .enableInjection() the app crashes. For example, I just tried to change the string in a Text("") and it crashed. In other views I'm able to make this change and it will live reload. |
You're saying things that were previously reliable with 15.2 now occasionally work and sometimes crash with Xcode 16. That seems unlikely. Are you sure that you've added .enableInjection() at every level of views you are trying to inject? You can't just add it at the top level. If you're obeying all the rules outlined in the https://github.com/johnno1962/HotSwiftUI project and you're still seeing problems I'd be interested to investigate further. Previously, this has been very reliable. |
So the problem is a UIKit component in my SwiftUI project. I've had: in my project but even I comment out this code the same problem occurs. When I make a change even outside of the UIKIt component, the app crashes with error Thread 1: signal SIGABRT at this line in the my UIKIt component's viewDidLoad function: |
Any ideas how to get this working? |
Have you tried Xcode 16.0? Is this specific to a particular version of iOS? Is there the possibility of have a look on Zoom? Can you try your app with the newer similar version of injection, https://github.com/johnno1962/InjectionNext? |
When I use Xcode 16 I'm getting a I just now tried the InjectionNext and HotSwiftUI combo but I get the same crash on app launch when using Xcode 16. Any diagnostics data I should gather to help figure this out? |
We need to know what caused the SIGABRT as that could be many things. Are you able to post the stack trace here or email it to me at GitHub at johnholdsworth.com? Was there no explanatory text? Which iOS runtime is this? |
Text of it, just in case:
|
Called from here: Text:
|
Seems to be a problem with dynamic loading. I have to ask are you sure you don't get the ABRT when InjectionNext/HotSwiftUI isn't configured? As another idea, it could be trying to load a bundle in HotSwiftUI which shouldn't happen when the InjectionClient class is present if you look at the single source file. Have you tried adding a breakpoint in |
You could experiment with some of this profiling to try to isolate the failure: |
Another thing to try: have you tried removing the -Xlinker -interposable flag? |
I won't have time to get to this until tomorrow. Thank you for the quick response! |
Another dimension to explore.. The main difference with Xcode 16 is how it links apps related to maintaining only one build area for previews. You could try reverting this change (with a "No"): |
@chadparker, as you're the second person who has reported this I'd like to have tried to track it down but if you don't get back to me there isn't much I can do. |
Yes I'm sorry, I haven't had the time to devote to troubleshooting this yet. I tried for a couple hours today and without adding When I add them in one target specifically I got this, and no view update. When I add them in the Project (affecting all targets), like I did with Inject/InjectionIII with Xcode 15, I get the crash as mentioned above. Nothing huge for an update, but that's what I've done so far. |
Thanks for getting back, it's interesting it seems to be related to the -interposabe flag. The next thing to try would be to turn the "Enable Debug Dylib Support" flag off which was the main difference with Xcode 16. With luck you can leave this flag disabled and re-instate the -interposable flag and have injection work (though Xcode previews might be a little slower) |
Trying the "Enable Debug Dylib Support" flag this morning. It looks like that property was not explicitly set in our project, and Xcode resolves it to "No". If I set it to "Yes" I get this diff in the project file: While setting it to "Yes" I get a crash caught by the debugger that looks like this: I don't know much about dynamic linking, but if there's somewhere I can look or a question I can ask the rest of the team I'd love to. |
At least enabling debug dylib is giving us a much more informative error message. I'd reintroduce -Xlinker -interposable target by target of your app rather than at the project level being sure to exclude the xctest-dynamic-overlay package. If you are able to zoom I'm available if you email and we could agree a time and we could cover more ground more quickly. |
I just sent you an email. A zoom call would be better, I agree! |
Any luck with your project now? |
I replaced all of the I'm going to show this issue to one of our senior devs to see if he has any ideas. |
Have you tried Xcode 16.2? |
It's -Xlinker -interposable not -interposable -Xlinker. -Xlinker introduces an option that is sent through to the linker. |
Thanks, I didn't realize this. First time using Inject. |
Still crashes the same on 16.2, unfortunately. |
@chadparker The We plan on finalizing the migration to the new library in the future. |
@chadparker Just wanted to check in again about this. |
I have tried again:
.package(
url: "https://github.com/pointfreeco/xctest-dynamic-overlay",
.upToNextMajor(from: Version(1, 4, 3))
)
dependencies: [
...
.product(name: "XCTestDynamicOverlay", package: "xctest-dynamic-overlay")
]
dependencies: [
...
.product(name: "IssueReporting", package: "xctest-dynamic-overlay")
] and I am still getting the crash. It feels like |
There has to be a solution to this. Interested in another zoom session sometime? |
I have a SwiftUI project and injection works as expected in xcode 15.2 with the app running in a simulator. However, in xcode 16 I get the 💉 Injected type # logs but the app doesn't actually update.
I tried deleting derived data, clean build folder, rebuild, double checked I have -Xlinker and -interposable, and double checked I'm running the debug scheme.
The text was updated successfully, but these errors were encountered: