johnno1962 / injectionforxcode

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

Can't get injection4xcode to work with facebook sdk #170

Closed FilipZawada closed 7 years ago

FilipZawada commented 7 years ago

For some reason after I installed Facebook SDK I got:

/Users/.../AppDelegate.swift:8:8: error: no such module 'FBSDKCoreKit'
Injection: /Users/.../AppDelegate.swift:8:8: error: no such module 'FBSDKCoreKit'
import FBSDKCoreKit
Injection: import FBSDKCoreKit
       ^
Injection:        ^
Injection: 
Injection: *** Learnt compile failed ***
Injection: 
Injection:  at /Users/.../Application Support/Developer/Shared/Xcode/Plug-ins/InjectionPlugin.xcplugin/Contents/Resources/common.pm line 57.
Injection:  main::error('Learnt compile failed') called at /Users/.../Library/Application Support/Developer/Shared/Xcode/Plug-ins/InjectionPlugin.xcplugin/Contents/Resources/injectSource.pl line 350

Appcode EAP (with Xcode 8 installed) Swift 3 FBSDK installed using latest Cocoapods

Regular compilation works, only injection fails. Any clues what may be wrong?

johnno1962 commented 7 years ago

I’m sorry this isn’t a type of error I’ve seen before. Suggest deleting Derived Data, rebuild and try again.

FilipZawada commented 7 years ago

That didn't help unfortunately. Any ideas how can I debug that?

johnno1962 commented 7 years ago

You can have a look at the compile command in the Project/Injection Plugin/Injection Console… The code concerned is in injectSource.pl, line 345. But it should “just work” as it uses the same command as the original compile.

FilipZawada commented 7 years ago

Thank you, I just moved to xcode which works well. AppCode EAP is not yet production ready.

BTW. I found one issue, not sure if it's worth reporting. When using swift enums enum Sth { case... }, after injection run-time error occurs. If I add @objc prefix before enum all works well. Let me know if you would like to investigate and have troubles reproducing that.

Thank you for the great work!

johnno1962 commented 7 years ago

I can imagine why the enum might be causing problems if you’re using - injected methods.