Latest 0.3.1
Homepage https://github.com/huangguiyang/RavenObjC
License MIT
Platforms ios 7.0
Frameworks UIKit
Authors

CI Status
Version
License
Platform

Introduction

RavenObjC was originally developed as a lightweight hot-fix solution for iOS. The app did fetch a decription file from remote and then apply the changes.

The description file may contain the class names, method names, returning values and arguments. The significant restriction is that RavenObjC only supports constants.

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

- (BOOL)origBOOL {
    return NO;
}

- (void)replaceReturnValue {
    NSLog(@"origBOOL: %@", [self origBOOL] ? @"YES" : @"NO"); // NO
    // replace return value to 'YES'
    RavenRR(@"RavenAppDelegate", @"origBOOL", @"YES", 0);
    NSLog(@"origBOOL: %@", [self origBOOL] ? @"YES" : @"NO"); // YES
}

- (void)origPerson:(NSString *)person {
    NSLog(@"Hello, %@", person);
}

- (void)replaceArguments {
    [self origPerson:@"Bob"];
    // replace 1st argument to 'David'
    RavenRA(@"RavenAppDelegate", @"origPerson:", nil, @{@"1": @"David"});
    [self origPerson:@"Bob"];
}

- (NSInteger)origInstanceMethod {
    return 1;
}

+ (NSInteger)origClassMethod {
    return 2;
}

- (void)undoReplaceInstanceMethod {
    NSLog(@"origInstanceMethod: %ld", [self origInstanceMethod]);
    RavenRR(@"RavenAppDelegate", @"origInstanceMethod", @"99", 0);
    NSLog(@"origInstanceMethod [Replaced]: %ld", [self origInstanceMethod]);
    RavenU(@"RavenAppDelegate", @"origInstanceMethod");
    NSLog(@"origInstanceMethod [Undo Replace]: %ld", [self origInstanceMethod]);
}

- (void)undoReplaceClassMethod {
    NSLog(@"origClassMethod: %ld", [[self class] origClassMethod]);
    RavenRR(@"RavenAppDelegate", @"origClassMethod", @"100", RavenROptionReplaceClass);
    NSLog(@"origClassMethod [Replaced]: %ld", [[self class] origClassMethod]);
    RavenU(@"RavenAppDelegate", @"origClassMethod");
    NSLog(@"origClassMethod [Undo Replace]: %ld", [[self class] origClassMethod]);
}

Requirements

iOS 7 or above

Installation

RavenObjC is available through CocoaPods. To install
it, simply add the following line to your Podfile:

pod 'RavenObjC'

Author

mario, [email protected]

License

RavenObjC is available under the MIT license. See the LICENSE file for more info.

Latest podspec

{
    "name": "RavenObjC",
    "version": "0.3.1",
    "summary": "RavenObjC is an ObjC extension to modify return value or arguments.",
    "description": "RavenObjC is an ObjC extension to modify return value or arguments.",
    "homepage": "https://github.com/huangguiyang/RavenObjC",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "mario": "[email protected]"
    },
    "source": {
        "git": "https://github.com/huangguiyang/RavenObjC.git",
        "tag": "0.3.1"
    },
    "platforms": {
        "ios": "7.0"
    },
    "source_files": "RavenObjC/Classes/**/*",
    "public_header_files": "RavenObjC/Classes/**/*.h",
    "frameworks": "UIKit"
}

Pin It on Pinterest

Share This