Closed JoySeeDog closed 8 years ago
you need to #import BundleInterface.h into your file or .pch file
#ifdef DEBUG
#define INJECTION_ENABLED
#import "/tmp/injectionforxcode/BundleInterface.h"
#endif
Yes,I imported ,but it also can't find.and some people has the same question as me. this is my .pch file and main.m file
// Include any system framework and library headers here that should be included in all compilation units. // You will also need to set the Prefix Header build setting of one or more of your targets to reference this file.
// From here to end of file added by Injection Plugin //
int main(int argc, char * argv[]) { @autoreleasepool { return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); } } // From here to end of file added by Injection Plugin //
static char _inMainFilePath[] = FILE; static const char *_inIPAddresses[] = {"10.0.0.23", "192.168.0.235", "127.0.0.1", 0};
i use two ways. first I use the INColors
the second ways,i use delegate and orrvride the two functions. [NSObject inSetDelegate:self forParameter:0];
but xcode can't find [NSObject inSetDelegate:self forParameter:0];
something wrong with installing? I use Alcatraz to install
Is DEBUG defined? Is your pch being compiled? Include BundleInterface.h in the source you are injecting from if there is any doubt.
I try to Include BundleInterface.h in the source I injected from,but it does't work. so amazing !
Are thhings not compiling or not the parameters not working? Is the project “patched"
wonderful ,I install it again.and it work !but the color can't be changed. here are my code ``#import "ViewController.h"
@interface ViewController ()
@end
@implementation ViewController
Colors are different, you need to add to viewDidLoad:
cool! perfect! thank you johnno! here are my code.
- (void)viewDidLoad {
[super viewDidLoad];
UIButton *button = [[UIButton alloc] initWithFrame:CGRectMake(100, 100, 100, 100)];
[button setTitle:@"TestButton" forState:UIControlStateNormal];
[button setTitleColor:[UIColor blueColor] forState:UIControlStateNormal];
[button addTarget:self action:@selector(test) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:button];
_label = [[UILabel alloc] initWithFrame:CGRectMake(100, 300, 100, 100)];
_label.textColor = [UIColor redColor];
[self.view addSubview:_label];
[NSObject inSetDelegate:self forParameter:0];
[NSObject inSetTarget:self action:@selector(inColor:hasChanged:) forColor:0];
}
- (void) test{
_label.text = @"hello!";
}
- (void)inParameter:(int)tag hasChanged:(float)value{
NSLog(@"------%f",value);
}
- (void)inColor:(int)tag hasChanged:(id)value{
self.view.backgroundColor = (UIColor *)value;
}
Does that work?? It should really be:
[NSObject inSetTarget:self.view action:@selector(setBackgroundColor:) forColor:0];
yes ,it work.you can try by it yourself and you sure NSObject can find the function setBackgroundColor?it crash because xccode can not find it. I don't think it a good way!
oops setBackgroundColor:
It works! so there are two ways!
using swift,I can use Tunable Parameters ,but use oc,xcode can‘t find function