johnno1962 / injectionforxcode

Runtime Code Injection for Objective-C & Swift
MIT License
6.55k stars 565 forks source link

One of the two will be used. Which one is undefined. #255

Open lee-eve opened 6 years ago

lee-eve commented 6 years ago

Hi,I have some problem When I use Injection III(AppStore Version),I have loaded it in Appdelate and implemented the injected method.

Injection connected, watching /Users/rouslee/Desktop/zuolin/zuolin_ResourceReservation_3.5/client_base_ios/ ** Compiling /Users/rouslee/Desktop/zuolin/zuolin_ResourceReservation_3.5/client_base_ios/EHProject/ResourceReservation/ViewCtl/ReservationMainViewCtl/EHResourceReservationMainViewCtl.m Loading .dylib - Ignore any duplicate class warning... objc[36655]: Class EHResourceReservationMainViewCtl is implemented in both /Users/rouslee/Library/Developer/CoreSimulator/Devices/5C07D31F-85DA-4889-8103-3E986942A5FC/data/Containers/Bundle/Application/D544CEB1-AD46-4B86-B19F-18B2D1443D5F/Techpark.app/Techpark (0x10ae39fd0) and /Users/rouslee/Library/Containers/com.johnholdsworth.InjectionIII/Data/eval101.dylib (0x13101d0a0). One of the two will be used. Which one is undefined.

The following questions , How can I fix it?

johnno1962 commented 6 years ago

You can ignore this message. It’s a warning.

lee-eve commented 6 years ago

But it don‘t work!

johnno1962 commented 6 years ago

This could be for all sorts of reasons. Have you tried the “GettingStarted.zip” example? Can you post the code you’re trying to inject?

johnno1962 commented 6 years ago

How do you mean?

lee-eve commented 6 years ago

Sorry, I didn't respond in time. I tried to change the background color simply in a view demo, but when I want to use it in a real project, the view is more complicated and it can't work.

// Code inside AppDelegate didFinishLaunchingWithOptions method
#if DEBUG
    NSBundle *bundle = [[NSBundle alloc] initWithPath:@"/Applications/InjectionIII.app/Contents/Resources/iOSInjection.bundle"];
    [bundle load];

#endif
// Code inside MyViewController 

- (void)injected {
    NSLog(@"injected Some thing....");
    [self viewDidLoad];
}
Chance-Cheng commented 5 years ago

Have you solved the problem?

TomLongJoy commented 5 years ago

Hello I have the same problem.

-(void)injected{ self.nameLabel.backgroundColor = UIColor.greenColor; }

💉 Compiling /Users/ZLJFaceCollectCell.m 💉 Loading .dylib - Ignore any duplicate class warning... objc[13410]: Class ZLJFaceCollectCell is implemented in both /Users/xxx (0x10544e328) and /Users/xxx/eval102.dylib (0x1331c8510). One of the two will be used. Which one is undefined. 💉 Loaded .dylib - Ignore any duplicate class warning...

bluelabeldeveloper1 commented 5 years ago

I got same error