Skip to content
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

Cannot use HotReloading with Other debug configurations (ex. Dev, Test Configuration) #82

Closed
gatherheart opened this issue Jun 8, 2023 · 12 comments

Comments

@gatherheart
Copy link

gatherheart commented Jun 8, 2023

Hello, I have a question.
When I use the HotReloading package with other configurations, the Injection does not start.
If I use a scheme that has "Test Configuration", I found that BundleInjection is not loaded and Injection doesn't start.
The "Test Configuration" is just a copy of "Debug Configuration" and only the name is different.

You can reproduce this situation even with SwiftUI-Kit after adding a new configuration and a new scheme using the new configuration.

Is there any way to use other configuration other than Debug? (Of course, except Release)
Thank you.



image

Related Issue:
#57 (comment)

@johnno1962
Copy link
Owner

johnno1962 commented Jun 8, 2023

Hi, are you sure your new configuration defines DEBUG for the compiler?
image

@gatherheart
Copy link
Author

gatherheart commented Jun 8, 2023

Hi @johnno1962 Thank you for your response.

Of course, I added it.
I just copied the default Debug configuration existing at the "SwiftUI Kit" project.

If you want the sample project, I can attach it.

image

@johnno1962
Copy link
Owner

johnno1962 commented Jun 8, 2023

Well, I guess it's just Xcode having a bad day. The other alternative is to download the app and use one of the prebuilt bundles (it's all the same code) provided you're not trying to inject on a device.

#if DEBUG
Bundle(path: "/Applications/InjectionIII.app/Contents/Resources/iOSInjection.bundle")?.load()
//for tvOS:
Bundle(path: "/Applications/InjectionIII.app/Contents/Resources/tvOSInjection.bundle")?.load()
//Or for macOS:
Bundle(path: "/Applications/InjectionIII.app/Contents/Resources/macOSInjection.bundle")?.load()
#endif

I'll see if I can replicate it and get to the bottom of what's going on.

@johnno1962
Copy link
Owner

johnno1962 commented Jun 8, 2023

This may be a silly question but how do you create a new configuration again?

@gatherheart
Copy link
Author

Okay, Thank you.
I'll use the prebuilt bundle until figuring it out.

In the project setting, there is a "Configurations" section, and the + button is for making new configurations.

image

@johnno1962
Copy link
Owner

Thanks for that, very strange though, I can't replicate the problem. Any chance of a small test project?

@gatherheart
Copy link
Author

gatherheart commented Jun 8, 2023

Did you change your scheme's configuration also?
If it uses Debug configuration, the problem might not happen

If you are using a scheme with debug configuration, Could you change the configuration into a new one?
Thanks for checking.

image image

Here is the sample project.
TestHotReload.zip

@gatherheart
Copy link
Author

I also try to find out what is the problem.
IMO, There might be some branches using the "Debug" configuration name.

@johnno1962
Copy link
Owner

Thanks for the sample project. It's an Xcode problem where it's not building the HotReloading package with -DDEBUG etc for anything other than a Debug configuration if you look at the build log. Seems like something is hard coded somewhere. I tried fixing it by adding the options to the Package.swift and all sorts of other problems came up. Perhaps you could file a radar for me?

@gatherheart
Copy link
Author

Okay. I will report it through Feedback Assistant.
Thanks for finding out sincerely.

I'll report it and keep track of what's going on in this thread.

@johnno1962
Copy link
Owner

johnno1962 commented Jun 8, 2023

Thanks for that and reporting this issue. It's interesting to know but I'm afraid there isn't much I can do about it. Can you put a link to this thread in the FB and post it's number here and perhaps I can bend someone's ear though I imagine they are pretty busy this time of year..

@johnno1962
Copy link
Owner

johnno1962 commented Jun 8, 2023

P.S. Seems like it compiles your packages for debugging (which is required for HotReloading to be enabled) if your configuration name contains the string Debug. Rename your config to "Test Debug" and it should work. Not exactly anticipated behaviour but difficult to think of what else they could have done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants