Closed MIyulong closed 4 years ago
Hi, Is SharePosterViewController on the screen?
Yes. When i press commandοΌs, this controller on the screen
εθͺζη iPhone
ε¨ 2019εΉ΄4ζ9ζ₯οΌ22:45οΌJohn Holdsworth notifications@github.com ειοΌ
Hi, Is SharePosterViewController on the screen?
β You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.
I had the same problem. Injection connected but doesn't call @objc func injected()
.
with Xcode10.1 + InjectionIII 1.5.1
π Injection connected, watching /Users/zhangferry/Desktop/MiniHabit/**
π *** Compiling /Users/zhangferry/Desktop/MiniHabit/MiniHabit/Scene/HomePage/HomePageViewController.swift ***
π Loading .dylib ...
objc[12468]: Class _TtC9MiniHabit22HomePageViewController is implemented in both /Users/zhangferry/Library/Developer/CoreSimulator/Devices/0977D680-9A84-4E93-A44A-8183597538B0/data/Containers/Bundle/Application/D45D7DF2-34B9-4E2D-8E2A-66B633EAECD5/MiniHabit.app/MiniHabit (0x100543ee8) and /Users/zhangferry/Library/Containers/com.johnholdsworth.InjectionIII/Data/eval101.dylib (0x12574caf0). One of the two will be used. Which one is undefined.
π Loaded .dylib - Ignore any duplicate class warning ^
π Injected 'HomePageViewController'
supplement:
When I use INJECTION_BUNDLE_NOTIFICATION
, it take effect only first time. Then I click Ctrl + s
, notification function would called but the modification of UI couldn't take effect.
Notification - always calls the old class reliably, so no new code is actually injected. The old class just runs over and over again. I tested this by changing the print statement inside the notification - never changed.
Function @objc func injected() - this gets called every now and then, but not on every save.
@objc func injected() {
print("RELOAD2-2-3-4-5")
self.reloadView()
}
π *** Compiling /Users/nik/work/omplanet/omplanet-ios/OMPlanet/OMPlanet/ViewControllers/Auth/EditUserBasicViewController.swift ***
π Loading .dylib ...
objc[47069]: Class _TtC8OMPlanet27EditUserBasicViewController is implemented in both /Users/nik/Library/Developer/CoreSimulator/Devices/2B4E1973-EB1B-4642-97CE-784AAFE3A13E/data/Containers/Bundle/Application/86103459-41FB-4104-931C-24F0908DF9B7/OMPlanet.app/OMPlanet (0x10be49058) and /Users/nik/Library/Containers/com.johnholdsworth.InjectionIII/Data/eval101.dylib (0x12fd3b950). One of the two will be used. Which one is undefined.
π Loaded .dylib - Ignore any duplicate class warning ^
π Injected 'EditUserBasicViewController'
VIEW INIT
setup user
RELOAD2-2-3-4
VIEW INIT
setup user
π *** Compiling /Users/nik/work/omplanet/omplanet-ios/OMPlanet/OMPlanet/ViewControllers/Auth/EditUserBasicViewController.swift ***
π Loading .dylib ...
π Loaded .dylib - Ignore any duplicate class warning ^
π Injected 'EditUserBasicViewController'
π *** Compiling /Users/nik/work/omplanet/omplanet-ios/OMPlanet/OMPlanet/ViewControllers/Auth/EditUserBasicViewController.swift ***
π Loading .dylib ...
objc[47069]: Class _TtC8OMPlanet27EditUserBasicViewController is implemented in both /Users/nik/Library/Developer/CoreSimulator/Devices/2B4E1973-EB1B-4642-97CE-784AAFE3A13E/data/Containers/Bundle/Application/86103459-41FB-4104-931C-24F0908DF9B7/OMPlanet.app/OMPlanet (0x10be49058) and /Users/nik/Library/Containers/com.johnholdsworth.InjectionIII/Data/eval102.dylib (0x12fe1e950). One of the two will be used. Which one is undefined.
π Loaded .dylib - Ignore any duplicate class warning ^
π Injected 'EditUserBasicViewController'
π *** Compiling /Users/nik/work/omplanet/omplanet-ios/OMPlanet/OMPlanet/ViewControllers/Auth/EditUserBasicViewController.swift ***
π Loading .dylib ...
objc[47069]: Class _TtC8OMPlanet27EditUserBasicViewController is implemented in both /Users/nik/Library/Developer/CoreSimulator/Devices/2B4E1973-EB1B-4642-97CE-784AAFE3A13E/data/Containers/Bundle/Application/86103459-41FB-4104-931C-24F0908DF9B7/OMPlanet.app/OMPlanet (0x10be49058) and /Users/nik/Library/Containers/com.johnholdsworth.InjectionIII/Data/eval103.dylib (0x12fe45950). One of the two will be used. Which one is undefined.
π Loaded .dylib - Ignore any duplicate class warning ^
π Injected 'EditUserBasicViewController'
π *** Compiling /Users/nik/work/omplanet/omplanet-ios/OMPlanet/OMPlanet/ViewControllers/Auth/EditUserBasicViewController.swift ***
π Loading .dylib ...
objc[47069]: Class _TtC8OMPlanet27EditUserBasicViewController is implemented in both /Users/nik/Library/Developer/CoreSimulator/Devices/2B4E1973-EB1B-4642-97CE-784AAFE3A13E/data/Containers/Bundle/Application/86103459-41FB-4104-931C-24F0908DF9B7/OMPlanet.app/OMPlanet (0x10be49058) and /Users/nik/Library/Containers/com.johnholdsworth.InjectionIII/Data/eval104.dylib (0x12fe6c950). One of the two will be used. Which one is undefined.
π Loaded .dylib - Ignore any duplicate class warning ^
π Injected 'EditUserBasicViewController'
π *** Compiling /Users/nik/work/omplanet/omplanet-ios/OMPlanet/OMPlanet/ViewControllers/Auth/EditUserBasicViewController.swift ***
π Loading .dylib ...
π Loaded .dylib - Ignore any duplicate class warning ^
π Injected 'EditUserBasicViewController'
VIEW INIT
setup user
RELOAD2-2-3-4-5
VIEW INIT
setup user
Note how I am reloading about 5 times before the change from print 1-2-3-4 to print 1-2-3-4-5 happens - in fact until the injection method is even called.
same problem but finally success after changing below option Build Setting -> Enable Testability -> YES @johnno1962 This may help to fix some bugs.
As the issue is still open, I will share what has helped me because I've also stumbled upon a similar issue @n13 had.
My setup: AppCode 2020.1.5, Simulator iOS 13.6, Swift 5, Injection III (2.2.0) from App Store.
I was seeing very similar log entries as @n13 and then I've decided to check the issue on some other empty view controller in the app by changing its background color and it was actually working. Thus I've returned to my view controller I wasn't able to see the changes loaded and started to strip off all the code until it became empty as the previous view controller. Then I ran the app in the simulator and started to change this empty view controller BUT then I saw the following log entry in the console:
π Injection connected π π Have you remembered to add "-Xlinker -interposable" to your project's "Other Linker Flags"? π Watching /Users/some-user/repos/my-awesome-project/**
Once I've added the mentioned flag for DEBUG configuration and put my whole code back to the initial view controller, all started to work.
Although, if you might not be able to run your app on the real iPhone if bitcode compilation is enabled and thus an error will be shown
-interposable and -bitcode_bundle (Xcode setting ENABLE_BITCODE=YES) cannot be used together
Removing the flag has helped to run on a device but then we are back to the same issue. However, now I can use injection and apply this workaround :)
Thanks for letting us know @gtennis, thatβs good to hear. You should find the new version much more reliable for Swift code.
Just seen your second post. Try something like this:
Great, thanks!
Gytenis
On Mon, Jul 20, 2020 at 11:29 PM John Holdsworth notifications@github.com wrote:
Just seen your second post. Try something like this: [image: image] https://user-images.githubusercontent.com/1786033/87988527-c41de500-cae0-11ea-97e3-5aaa5d09b503.png
β You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/johnno1962/InjectionIII/issues/128#issuecomment-661343221, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAKWB7OCCDTTP6RXWTUAWMDR4SZKZANCNFSM4HERELJA .
@MIyulong Do you reload you ViewController? I "have" the same issue before, and then I realized change the UILabel.text or other similar action dose not reload the ViewController automatically (only if you do it yourself when received INJECTION_BUNDLE_NOTIFICATION Notification).
when i use
command + s
, the function of "@objc func injected()" doesn't be called, the terminal log isand i use version 10.1 xcode and version 1.51 injectionIII, in AppDelegate.swift, i add this
Bundle(path: "/Applications/InjectionIII.app/Contents/Resources/iOSInjection10.bundle")?.load()