1、tableViewCell 分割线边距缩进
-(void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath {
// 设置分割线左右边距
if ([cell respondsToSelector:@selector(setSeparatorInset:)]) {
[cell setSeparatorInset:UIEdgeInsetsMake(0,100, 0,8)];
}
//
if ([cell respondsToSelector:@selector(setPreservesSuperviewLayoutMargins:)]) {
[cell setPreservesSuperviewLayoutMargins:NO];
}
// 设置cell左右边距
if ([cell respondsToSelector:@selector(setLayoutMargins:)]) {
[cell setLayoutMargins:UIEdgeInsetsMake(0, 8, 0,8)];
}
}
#2、cocoapods降级操作
1查看当前版本
pod --version
2查看安装列表
gem list
3卸载
sudo gem uninstall cocoapods -v 1.3.1
4安装
sudo gem install cocoapods -v 1.3.1
sudo gem uninstall cocoapods
先查看本地安装过的cocopods相关东西,命令如下:
$ gem list –local | grep cocoapods
会显示如下:
cocoapods-core (0.39.0)
cocoapods-downloader (0.9.3)
cocoapods-plugins (0.4.2)
cocoapods-search (0.1.0)
cocoapods-stats (0.6.2)
cocoapods-trunk (0.6.4)
cocoapods-try (0.5.1)
然后逐个删除吧:
$ sudo gem uninstall cocoapods-core
#2.1 安装RVM
curl -L get.rvm.io | bash -s stable
source ~/.bashrc
source ~/.bash_profile
rvm -v
rvm list known
rvm install 2.3.0
#3、Runtime之交换方法
+ (void)methodSwizzlingWithOriginalSelector:(SEL)originalSelector
bySwizzledSelector:(SEL)swizzledSelector {
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
Class class = [self class];
Method originalMethod = class_getInstanceMethod(class, originalSelector);
Method swizzledMethod = class_getInstanceMethod(class, swizzledSelector);
BOOL didAddMethod = class_addMethod(class,originalSelector,
method_getImplementation(swizzledMethod),
method_getTypeEncoding(swizzledMethod));
if (didAddMethod) {
class_replaceMethod(class,swizzledSelector,
method_getImplementation(originalMethod),
method_getTypeEncoding(originalMethod));
} else {
method_exchangeImplementations(originalMethod, swizzledMethod);
}
});
}
#上架应用预览
https://itunes.apple.com/cn/app/yan-yu/id1393900517
系统相册界面上移
是因为全局设置了ScrollView属性导致的.
if (@available(iOS 11.0, *)){//避免滚动视图顶部出现20的空白以及push或者pop的时候页面有一个上移或者下移的异常动画的问题
[[UIScrollView appearance] setContentInsetAdjustmentBehavior:UIScrollViewContentInsetAdjustmentNever];
}
在调用相册前重置就好了
if (@available(iOS 11, *)) {
UIScrollView.appearance.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentAutomatic;
}
如何防止反编译
1、对本地数据存储NSUserDefault,sqlite进行加密处理,保护关键信息 (本地数据加密)
2、对程序中出现的URL进行加密处理,防止URL被静态分析 (URL地址加密)
3、对客户端的网路请求数据进行加密,防止通过网络拦截获取数据 (请求数据加密)
4、代码混淆
5、第三方防护,网易云盾
Xcode编译错误
Warning: The Copy Bundle Resources build phase contains this target's Info.plist file 'Proj/Other/Info.plist'.
编译时将 info.plist文件也进行了编译
解决方案: 在 Copy Bundle Resources中将警告文件删除重新编译即可