PPPatch 0.0.1

PPPatch 0.0.1

测试已测试
Lang语言 Obj-CObjective C
许可证 MIT
发布最后发布2015年5月

PonyCui 维护。



PPPatch 0.0.1

  • PonyCui

PPPatch 帮助您修补已发布的应用程序。

我们都知道修复发布应用程序需要向 iTunesConnect 提供包,并且您还需要申请特殊请求。有没有什么更好的方法来避免这种情况?PPatch 是解决此问题的最佳库。

介绍

PPPatch 是一个轻量级的方法交换库,提供以下功能:

1.使类选择器无效;

2.在触发选择器时显示自定义 UIAlertView 一次或每次;

3.为特定选择器返回自定义值;

4.从一个视图移除一个视图;

5.禁用视图(将 userInteractionEnabled 设置为 NO);

6.对视图执行 KVC。

示例

{
  "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."
    }
  ]
}
  • 将以上代码添加到 -application:didFinishLaunchingWithOptions:
[PPPatch setEnabled:YES];
[PPPatch setPatchURLString:@"https://raw.githubusercontent.com/PonyCui/PPPatch/master/PPPatch/patch.json"];
[PPPatch fetchPatchWithTimeout:3.0];

好的,这就足够了。最终结果请看演示。

修补类型

patchType 定义了一个项操作。

/**
 *  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
};

安装

手动

*.m *.h 中的内容复制到您的项目中。

注意

  • PPatch 是 0.0.1 测试版。
  • PPPatch 可以缓存之前的修补数据,当用户网络或服务器不稳定时,修补仍然生效。