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
中的内容复制到您的项目中。