tokorom / blockinjection Goto Github PK
View Code? Open in Web Editor NEWYou can insert some Blocks before and after the method like Aspect Oriented Programming.
License: MIT License
You can insert some Blocks before and after the method like Aspect Oriented Programming.
License: MIT License
What do you think about having the possibility for the preprocess block to return a value to indicate if it should continue invoking the original and the post-process?
MyViewController
has a child view controller (added using addChildViewController:
)
If a add this follow code to MyViewController
[BILib injectToClassWithName:@"MyViewController" methodName:@"viewDidAppear:" preprocess:^{
}];
I get this
-[ChildViewController __mi_pre_0_viewDidAppear:]: unrecognized selector sent to instance
Is there a work around for this issue?
Hello everyone !
I have asked the question on stack overflow but I can not understand an answer. Could you please show how to solve this issue with the help of your framework.
Link - http://stackoverflow.com/questions/27254568/aop-solve-academic-example
Thanks!
[BILIB insertPreprocessToSelector:@selector(setFrame:) forClass:[UIView class] block:^{
// ...
}];
In this case, your application crashes.
Failed with return value of more than 5byte.
For example,
[BILib injectToClassWithName:@"UIView" methodName:@"frame" preprocess:^{
}];
is failed.
#pragma mark - Parent
@interface Parent : NSObject
- (void)sayMessage:(NSString*)message;
@end
@implementation Parent
- (void)sayMessage:(NSString*)message
{
NSLog(@"Parent says: %@", message);
}
@end
#pragma mark - Child
@interface Child : Bizz
@end
@implementation Parent
- (void)sayMessage:(NSString*)message
{
NSLog(@"Child says: %@", message);
}
@end
// ...
[BILIB insertPreprocessToSelector:@selector(sayMessage:) forClass:[Child class] block:^{
// ...
}];
In this case, Child's sayMesasge: is not called and only Parent's sayMessage: is called.
My english not very well, but I will try.
In method - (void_)invokeWithTarget:(id)target args:(va_list_)args of BIItem class you are using __builtin_alloca(returnLength);
This method allocate memory in a current stack, xCode has showed that in some case you can return pointer to the memory. And it can make crash.
May be I am wrong, and pointer will change after __builtin_alloca method, but it is very danger place.
Hi.
When I tried to add following codes in Master-Detail-Application template project,
UIView subclass (UINavigationButton in this example) didn't perform
-sizeThatFits:
injection block (also seen in other cases e.g. [cell.textLabel sizeToFit]).
Is this a bug, or am I missing something?
// MasterViewController.m from Master-Detail-Application
+ (void)initialize
{
[BILib injectToClass:[UIView class] selector:@selector(sizeToFit) preprocess:^(id obj){
NSLog(@"%@ sizeToFit", [obj class]);
}];
Class testClass;
testClass = [UIView class]; // this doesn't work
//testClass = NSClassFromString(@"UINavigationButton"); // this works
[BILib injectToClass:testClass selector:@selector(sizeThatFits:) preprocess:^(id obj, CGSize size){
NSLog(@"%@ sizeThatFits %@", [obj class], NSStringFromCGSize(size));
}];
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.