GithubHelp home page GithubHelp logo

felix's Introduction

这是什么

一个基于 Aspects 的轻量级 iOS Hotfix,核心原理是结合 Aspects 自带的动态替换方法加上 OC 原生的动态调用方法的能力,通过 JSCore 作为 Bridge 来达到效果。

特点

  • 基于 Aspects,降低审核风险(Aspects已在上百款 App 使用),我自己也测试过可以通过审核。
  • 没有 JS 中间层,直接使用 OC 暴露给 JS 的方法。
  • 只支持 id 和 primative 类型的数据。
  • 所有的方法都有 test case 覆盖 (详见 Tests.m )。

仅作为发生「线上 App 有大问题,又不想发版」时的一个备选项。

Demo

更多用法参见 Tests.m

Replace Class Selector Return Value

[Felix evalString:@"fixClassMethod('ClassSelectorDemo', 'oneParameterReturn:', function(instance, invo) {invoke(invo); setInvocationReturnValue(invo, 'replaced');})"];

NSString *result = [ClassSelectorDemo oneParameterReturn:@"yes"];
XCTAssert([result isEqualToString:@"replaced"]);

[Felix evalString:@"fixClassMethod('ClassSelectorDemo', 'onePrimativeNumberParameterReturn:', function(instance, invo){invoke(invo); setInvocationReturnValue(invo, 42);})"];

NSInteger _result = [ClassSelectorDemo onePrimativeNumberParameterReturn:1];
XCTAssert(_result == 42);

[Felix evalString:@"fixClassMethod('ClassSelectorDemo', 'onePrimativeBooleanParameterReturn:', function(instance, invo){invoke(invo); setInvocationReturnValue(invo, false);})"];

BOOL __result = [ClassSelectorDemo onePrimativeBooleanParameterReturn:YES];
XCTAssert(!__result);

[Felix evalString:@"fixClassMethod('ClassSelectorDemo', 'oneCustomeObjectParameter:', function(instance, invo){invoke(invo); var obj = callClassMethod('Flager', 'new'); setInvocationReturnValue(invo, obj);})"];

Flager *flager = [Flager new];
Flager *___result = [ClassSelectorDemo oneCustomeObjectParameter:flager];
XCTAssert(!___result.flaged);

felix's People

Contributors

nasitray avatar limboy avatar wait10000y avatar

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.