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

my injection doesn't work #93

Open
ghost opened this issue Mar 14, 2016 · 19 comments
Open

my injection doesn't work #93

ghost opened this issue Mar 14, 2016 · 19 comments

Comments

@ghost
Copy link

ghost commented Mar 14, 2016

I just change the text of uilabel for test.
2016-03-14 7 40 45
2016-03-14 7 43 01

I don't understand.
Can you help me fix that issue

@TangTangWan
Copy link

The same problem came up to me. And the outputs in the console are similar to yours.
I downloaded my injection plugin from http://injectionforxcode.com/, and my Xcode version is 7.2.1.

@johnno1962
Copy link
Owner

Normally this is becuase the ViewController has not been reloaded.

@ghost
Copy link
Author

ghost commented Mar 14, 2016

ctrl + = didn't make ViewController reload.I must try command + R.

@johnno1962
Copy link
Owner

Injection changes the code but it needs to be re-executed i.e. -viewDidLoad needs to be called again. You could add a -injected method to the view controller and have it call -viewDidLoad for testing.

@ghost
Copy link
Author

ghost commented Mar 14, 2016

Thank you very much.You save my life:)

@huanghe810229530
Copy link

why close? I can't solve this problem, help...

@ghost
Copy link
Author

ghost commented Mar 16, 2016

func injected(){
     viewdidload()
}

just do that,then it works.

@jonsnowwinterfell
Copy link

i still have no idea to make the plugin works ,when i Use the shortcut “control =" nothing happen in xocde
127af1e8-4a44-4aec-b872-934b9e7131b4

@ghost
Copy link
Author

ghost commented Mar 16, 2016

Maybe u can install injection once again,then use command + q to close Xcode and reopen Xcode.
U will see injection work.Hope to be useful to u.

@superleexpert
Copy link

I have met the similar issue about that do not work in a UIView class when adjust some properties on xcode7.2.

And I solved through changed method in -(void)injection. But it is not flexible. I really expect that code change everywhere and all will worked by "control+=".

@huanghe810229530
Copy link

@lingang009 It is not flexible, but thank you! It improves the efficiency!

@orta
Copy link
Collaborator

orta commented Mar 19, 2016

People on this thread, maybe it might be a good idea to ask someone with good english and chinese skills to work on a translation of the README/docs?

@ghostSamu
Copy link

i have the same problem, my Xcode version is 7.2.
i had added the method
-(void)injected{
[self viewDidLoad];
}

it can refresh UI
but it still print the message :

Class HomeViewController is implemented in both
Developer/CoreSimulator/Devices/0C35732D-086B-4BDA-9C0E-DF10E731D82F/data/Containers/Bundle/Application/302CFF8A-9645-4721-88FC-F7C12D92A2C7/GaoKaoHelper.app/GaoKaoHelper
and
Desktop/GaoKaoHelper/iOSInjectionProject/build/Debug-iphonesimulator/InjectionBundle2.bundle/InjectionBundle.
One of the two will be used. Which one is undefined.
2016-07-11 00:19:26.350 GaoKaoHelper[61611:9789048] Ignore any warning, Swizzled HomeViewController 0x111760598 -> 0x104fa7b48
8 injections performed so far.

@johnno1962
Copy link
Owner

The message is a warning. Add an NSLog to see if -injected gets called.

@ghostSamu
Copy link

@johnno1962

yes ,it is called.

i just don't understand this message:
One of the two will be used. Which one is undefined.
one is in .app
one is in bundle
can i choose just one? how?

@johnno1962
Copy link
Owner

johnno1962 commented Jul 11, 2016

The warning comes from the runtime. You can ignore it. Injection does the right thing.

@tolord
Copy link

tolord commented Jul 18, 2016

  • (void)loadView {
    [super loadView];
    self.title = @"服务管理";
    self.view.backgroundColor = COLOR_GRAY_EE;
    [self initLeftBarButtonBack];
    self.emptyString = @"您还没开通任何服务,赶快开通吧";
    }

i change the self.title's name,and then i press shift + control + = ,then,the window became empty
why??

log is here
//--------------------------------------------
objc[40764]: Class InjectionBundle3 is implemented in both /Users/liaozhongru/Desktop/3.application/AKServer/iOSInjectionProject/build/Debug-iphonesimulator/InjectionBundle2.bundle/InjectionBundle and /Users/liaozhongru/Desktop/3.application/AKServer/iOSInjectionProject/build/Debug-iphonesimulator/InjectionBundle5.bundle/InjectionBundle. One of the two will be used. Which one is undefined.
objc[40764]: Class AKServiceManageViewController is implemented in both /Users/liaozhongru/Library/Developer/CoreSimulator/Devices/7C1D8286-1B79-43BF-934B-61CAC7F70326/data/Containers/Bundle/Application/62F43460-59E2-45CD-9066-D4F677705BD0/alijkManager.app/alijkManager and /Users/liaozhongru/Desktop/3.application/AKServer/iOSInjectionProject/build/Debug-iphonesimulator/InjectionBundle5.bundle/InjectionBundle. One of the two will be used. Which one is undefined.
2016-07-18 17:40:26.268 alijkManager[40764:4320988] BundleInjection.h [Line: 1005] __41+[BundleInjection autoLoadedNotify:hook:]_block_invoke Ignore any warning, Swizzled AKServiceManageViewController 0x122535c00 -> 0x107448bb8
30 injections performed so far.

@johnno1962
Copy link
Owner

You are using “inject and reset” by mistake whicih doesn’t always work. Use "control - =" not "control - shift - ="

@Huang-Libo
Copy link

@lingang009
Thanks, you save my life!

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

No branches or pull requests

9 participants