PPPatch 0.0.1

PPPatch 0.0.1

TestsTested
LangLanguage Obj-CObjective C
License MIT
ReleasedLast Release May 2015

Maintained by PonyCui.



PPPatch 0.0.1

  • By
  • PonyCui

PPPatch helps you patch released application.

We all know that to fix a release application needs to provide a package to iTunesConnect, also you need to apply specail request. Is there any great way to avoid that? PPPatch is the best library helps you resolve this problem.

Introduce

PPPatch is a light weight method swizzling library, provides above functions.

1.Invalid a class selector;

2.Show custom UIAlertView once or everytime when selector triggered;

3.Return custom value for specific selector;

4.Remove a view from superView;

5.Disabled a view (make userInteractionEnabled = NO);

6.Perform KVC to view.

Example

{
  "ver": "1.0",
  "items": [
    {
      "category": "PPPatchSelectorItem",
      "className": "ViewController",
      "selectorName": "testLog",
      "patchType": "100"
    },
    {
      "category": "PPPatchSelectorItem",
      "className": "ViewController",
      "selectorName": "testLog",
      "patchType": "101",
      "alertTextString": "Test log temperary unavailable."
    }
  ]
}
  • Add above code to - application:didFinishLaunchingWithOptions:
[PPPatch setEnabled:YES];
[PPPatch setPatchURLString:@"https://raw.githubusercontent.com/PonyCui/PPPatch/master/PPPatch/patch.json"];
[PPPatch fetchPatchWithTimeout:3.0];

Okay, that's enough. The final result see demo please.

Patch Type

The patchType defines an item operation.

/**
 *  PPPatch Type
 */
typedef NS_ENUM(NSInteger, PPPatchType){
    /**
     *  Unknown Type
     */
    PPPatchTypeUnknown = 0,
    /**
     *  Invalid a class selector
     */
    PPPatchTypeSelectorInvalid = 100,
    /**
     *  Show AlertView when selector performs
     */
    PPPatchTypeSelectorAlert = 101,
    /**
     *  Replace return value
     */
    PPPatchTypeSelectorReturn = 102,
    /**
     *  Same as PPPatchTypeSelectorAlert, but alertView only show once each app version.
     */
    PPPatchTypeSelectorAlertOnce = 103,
    /**
     *  Remove User Interface from superView
     */
    PPPatchTypeUIRemoveFromSuperView = 200,
    /**
     *  Disable User Interface
     */
    PPPatchTypeUIDisabled = 201,
    /**
     *  Set UI Key => Value
     */
    PPPatchTypeUISettingKeyValue = 202
};

Installation

Manually

Copy *.m *.h in Src/ to your project.

Notice

  • PPPatch is 0.0.1 beta.
  • PPPatch can cache previous patch data, while user network or server not stable, patch still effects.