johnno1962 / injectionforxcode

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

Not able to Inject in swift Project #98

Open ajaybeniwal opened 8 years ago

ajaybeniwal commented 8 years ago

Injection fails in my project at the below line

while ( field->flags == 0x2 ) { if ( field->optional ) { field = field->optional; optr++ = '?'; optr = '\000'; } --More Logs

TtC11TransitFare19FirstViewController is implemented in both /Users/ajasingh/Library/Developer/CoreSimulator/Devices/1459A52A-E4D5-4302-BF1F-7034EF5119B6/data/Containers/Bundle/Application/879D997B-5AE3-432E-B795-45BFC232FF56/TransitFare.app/TransitFare and /Users/ajasingh/Development/SwiftTransportApp/TransitFare/iOSInjectionProject/build/Debug-iphonesimulator/InjectionBundle2.bundle/InjectionBundle. One of the two will be used. Which one is undefined. 1 injections performed so far. 2016-03-16 17:39:59.466 TransitFare[15349:3729938] Ignore any warning, Swizzled TransitFare.FirstViewController 0x12178d130 -> 0x10e0a43a0 (lldb)

johnno1962 commented 8 years ago

Hi, your project must have an instance variable the “-injected” code does not cope with. It’s a bit of a hack really. I’m afraid you’ll have to find an alternative to using -injected such as using “INJECTION_BUNDLE_NOTIFICATION”. Injection itself will still work it is the “sweep” of all the objects in your application for -injected that is failing.

johnno1962 commented 8 years ago

If you want to “TeamView” to try to sort this out let me know. What version of Xcode is this?

ajaybeniwal commented 8 years ago

Xcode 7.2.1

johnno1962 commented 8 years ago

If you follow the stack up you can see the class and instance variable that is causing the problem. Can you tell me it’s type?