Giter VIP home page Giter VIP logo

blockinjection's People

Contributors

mvasilak avatar tokorom avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

blockinjection's Issues

Skipping original method after preprocess

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?

Crashing if there is a child view controller

Precondition

MyViewController has a child view controller (added using addChildViewController:)

Crashing Issue

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?

Fail with UIView's setFrame: method

 [BILIB insertPreprocessToSelector:@selector(setFrame:) forClass:[UIView class] block:^{
  // ...
}];

In this case, your application crashes.

Fail with overriden method

#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.

Question: xCode warning in method - (void*)invokeWithTarget:(id)target args:(va_list*)args

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.

Injecting to [UIView sizeThatFits:] doesn't work in some subclasses

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));
    }];
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.