MARK 开发小细节:
1、pem 转 cer 证书:$ openssl x509 -in 214588721660321.pem -out testcert.cer -outform der
2、url含中文: NSString *encodedURLString = (NSString*)CFBridgingRelease(CFURLCreateStringByAddingPercentEscapes(kCFAllocatorDefault,(CFStringRef)post_url,(CFStringRef)@"!$&'()*+,-./:;=?@_~%#[]",NULL,kCFStringEncodingUTF8));
3.隐藏状态栏 调用此方法:flag、、隐藏或展示
-(void)dosonme{
if([self respondsToSelector:@selector(setNeedsStatusBarAppearanceUpdate)]) {
[self prefersStatusBarHidden:flag];
[self performSelector:@selector(setNeedsStatusBarAppearanceUpdate)];
}
}
-(BOOL)prefersStatusBarHidden:(int)flag
{
returnflag;
}
4、正则切割字符串:
NSString *test = @"1qe#dsadsadas#htt#234#www.badidu.com 我的";
NSString*regexStr =@"(#\\w+#)";//含#qwe#的字符串
NSError*error;
NSRegularExpression* regex = [NSRegularExpression regularExpressionWithPattern:regexStr
options:0
error:&error];
NSArray*array = [regexmatchesInString:testoptions:0range:NSMakeRange(0, test.length)];
NSMutableArray *replaceStrS = [[NSMutableArray alloc]initWithCapacity:array.count];
for(NSTextCheckingResult *str2in array)
{
NSString*str = [testsubstringWithRange:str2.range];
[replaceStrSaddObject:str];
LFLog(@"---->%@",str);
}
5、ios调用私有方法:(例子)
/*三方库私有方法*/
- (void)cl_progressSliderTouchBegan:(CLSlider*)slider{
SEL selector = NSSelectorFromString(@"cl_progressSliderTouchBegan:");
((void(*)(id,SEL,id))[self.playerViewmethodForSelector:selector])(self.playerView, selector,slider);
}
6重写私有方法:(例子🌰)
Method oriM =class_getInstanceMethod(_playerView.class,@selector(私有方法));
Method newM =class_getInstanceMethod(self.class,@selector(需要变成的方法));
method_exchangeImplementations(oriM, newM);
7获取属性
unsigned int outCount =0;
Ivar* ivars =class_copyIvarList([_playerView class], &outCount);
for(unsigned int i =0; i < outCount; i ++) {
Ivar ivar = ivars[i];
const char* name =ivar_getName(ivar);
const char* type =ivar_getTypeEncoding(ivar);
NSLog(@"类型为 %s 的 %s ",type, name);
}
free(ivars);
//获取方法
unsignedintmethCount =0;
Method*meths =class_copyMethodList([UITextFieldclass], &methCount);
for(inti =0; i < methCount; i++) {
Methodmeth = meths[i];
SELsel =method_getName(meth);
constchar*name =sel_getName(sel);
NSLog(@"%s", name);
8、通知中心的坑(注意 app完全关闭后 和 后台前台获取方式不一样)
在APP完全被关闭后,收到通知后:
在后台/前台,app未关闭时:
未关闭时候处理的数据,使用的是阿里推送9.数组去重一步搞定
NSArray *newArr = [oldArr valueForKeyPath:@“@distinctUnionOfObjects.self"];
10. 上线app 用户为ios 9.2.1 下载崩溃
mark:UI切图很关键,不规范图将导致无法安装/出现一安装即崩溃现象,恶心心
解决方法:解压ipa-》终端 -》cd 到(App\ 2018-08-27\ 16-02-21/App/Payload )-》$ find . -name 'Assets.car'-》$ sudo xcrun --sdk iphoneos assetutil --info ./App.app/Assets.car > Assets.json
打开Assets.json 搜索:"DisplayGamut" : "P3" ,删除或者重新修改图片
搜索p3结果
网友评论