johnno1962 / injectionforxcode

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

tvOS support? #112

Closed rshev closed 8 years ago

rshev commented 8 years ago

Would be thrilled to use in my tvOS project, because it's working great in my iOS projects! Getting this error when I'm trying to inject:

2016-03-26 17:51:50.380 Error loading /Users/xxxxxxxxx/Library/Application Support/Developer/Shared/Xcode/Plug-ins/InjectionPlugin.xcplugin/Contents/Resources/InjectionLoader.bundle/InjectionLoader:  dlopen(/Users/xxxxxxxxx/Library/Application Support/Developer/Shared/Xcode/Plug-ins/InjectionPlugin.xcplugin/Contents/Resources/InjectionLoader.bundle/InjectionLoader, 265): Library not loaded: /usr/lib/libstdc++.6.dylib
  Referenced from: /Users/xxxxxxxxx/Library/Application Support/Developer/Shared/Xcode/Plug-ins/InjectionPlugin.xcplugin/Contents/Resources/InjectionLoader.bundle/InjectionLoader
  Reason: no suitable image found.  Did find:
    /usr/lib/libstdc++.6.dylib: mach-o, but not built for TV OS simulator
johnno1962 commented 8 years ago

Can you try with “patched” injection? https://github.com/johnno1962/injectionforxcode/blob/master/documentation/patching_injection.md

rshev commented 8 years ago

Build fails if the project is patched:

/tmp/injectionforxcode/BundleInjection.h:117:17: error: 'UIAlertView' is unavailable: not available on tvOS
/tmp/injectionforxcode/BundleInjection.h:866:9: error: 'UIAlertView' is unavailable: not available on tvOS
/tmp/injectionforxcode/BundleInjection.h:866:44: error: 'UIAlertView' is unavailable: not available on tvOS
rshev commented 8 years ago

After commenting those UIAlertViews out, it builds but fails searching for frameworks. After specifying ../** as framework search paths it works and injects. So it seems that minor fixes are needed to make it operating out-of-the-box on tvOS.

rshev commented 8 years ago

Addressed in my pull request.