目录
1.iOS手机号码校验
1.iOS手机号码校验
下面代码方法有判断号段;有些需要具体判断大陆、港澳地区参考帮邦行司机端代码
https://www.cnblogs.com/guozhihe/p/12923555.html
//手机号码校验
+(BOOL)verifyPhoneNumber:(NSString*)phone;
//手机号码校验
+(BOOL)verifyPhoneNumber:(NSString*)phone{
phone = [phone stringByReplacingOccurrencesOfString:@" " withString:@""];
if (phone.length != 11){
return NO;
}else{
//130-199 11位
NSString * NUM = @"^1(3[0-9]|4[579]|5[0-35-9]|6[2567]|7[0-35-8]|8[0-9]|9[189])\\d{8}$";//有判断号段
//NSString * NUM = @"^((1[3-9][0-9]))\\d{8}$";只判断长度格式不需要号段的用这个
NSPredicate *pred = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", NUM];
BOOL isMatch = [pred evaluateWithObject:phone];
if (isMatch) {
return YES;
}else{
return NO;
}
}
}
2.关于使用NSURL *url = [NSURL URLWithString:String];url为空的问题
NSURL *url = [NSURL URLWithString:String];一直返回为空,这是有的链接需要转换一下utf8才能正常加载,有的不需要转换直接可以加载,所以一起直接转换再加载比较稳妥。
urlString = [urlStr stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
NSURL *url = [NSURL URLWithString:urlString];
3.百度地图根据经纬度进行逆编码
地理编码指的是将地址信息建立空间坐标关系的过程,又可分为正向地理编码和反向地理编码。
- 正向地理编码指的是由地址信息转换为坐标点的过程。该功能适用于根据用户输入的地址确认用户具体位置的场景,常用于配送人员根据用户输入的具体地址找地点。
- 反向地理编码服务实现了将地址坐标转换为标准地址的过程。反向地理编码提供了坐标定位引擎,帮助用户通过地面某个地物的坐标值来反向查询得到该地物所在的行政区划、所处街道、以及最匹配的标准地址信息。通过丰富的标准地址库中的数据,可帮助用户在进行移动端查询、商业分析、规划分析等领域创造无限价值。
相关链接:
https://blog.csdn.net/wjchao1990/article/details/51727669
https://xiaozhuanlan.com/topic/4968730251
https://blog.csdn.net/nameis2541748437/article/details/49766105
https://www.cnblogs.com/guitarandcode/p/5783805.html(CLPlacemark属性)
demo:
起终点模型里面的经纬度属性:
@property (nonatomic,assign) CGFloat lng;
@property (nonatomic,assign) CGFloat lat;
当前页面VC里面的属性:
@property (nonatomic, strong) BMKGeoCodeSearch *search;//逆编码
@property (nonatomic, strong) BMKGeoCodeSearch *searchTwo;
@property (nonatomic, copy) NSString *adCode;//城市编码(城市的区id)
@property (nonatomic, copy) NSString *adCodeTwo;
遵循协议:
- (SKOrderElement *)orderElement {
SKOrderElement *element = [[SKOrderElement alloc] init];
element.start = self.startAddress.toElementsAddress;
element.start.phone = self.phoneNum;
element.start.name = isNullString(self.contactName) ? @"本人" : self.contactName;
element.end = self.endAddress.toElementsAddress;
if (self.curOrderType == OrderType_Carpool) {
element.count = self.peopleNumber;
} else {
element.count = 1;
}
// 起终点坐标转化增加位置参数
CGFloat startLat = element.start.location.lat;//起点坐标
CGFloat startLng = element.start.location.lng;//终点坐标
CLLocation *startLocation = [[CLLocation alloc] initWithLatitude:startLat longitude:startLng];
self.search = [[BMKGeoCodeSearch alloc] init];
self.search.delegate = self;
BMKReverseGeoCodeSearchOption *reverseGeoCodeOption = [[BMKReverseGeoCodeSearchOption alloc]init];
reverseGeoCodeOption.location = startLocation.coordinate;
reverseGeoCodeOption.isLatestAdmin = YES;//是否访问最新版行政区划数据(仅对中国数据生效)
BOOL flag = [self.search reverseGeoCode: reverseGeoCodeOption];
if (flag) {
NSString *province = _startAddress.province;
NSString *district = _startAddress.district;
NSString *city_cn = _startAddress.city;
NSString *city_code = self.adCode;
element.start.province = province?province:@"";//省
element.start.district = district?district:@"";//区
element.start.city_cn = city_cn?city_cn:@"";//市
element.start.city_code = city_code?city_code:@"";//城市行政编码
NSLog(@"逆geo检索发送成功");
NSLog(@"输出的省份:%@ --城市:%@ --区:%@ --城市编码:%@",province,district,city_cn,city_code);
} else {
NSLog(@"逆geo检索发送失败");
}
CGFloat endLat = element.end.location.lat;
CGFloat endLng = element.end.location.lng;
CLLocation *endLocation = [[CLLocation alloc] initWithLatitude:endLat longitude:endLng];
CLGeocoder *geocoderTwo = [[CLGeocoder alloc] init];
[geocoderTwo reverseGeocodeLocation:endLocation completionHandler:^(NSArray *array, NSError *error) {
if (array.count > 0) {
CLPlacemark *placemark = [array objectAtIndex:0];
if (placemark != nil) {
NSString *provinceTwo = placemark.administrativeArea;
NSString *districtTwo = placemark.subLocality;
NSString *city_cnTwo = placemark.locality;
element.end.province = provinceTwo?provinceTwo:@"";
element.end.district = districtTwo?districtTwo:@"";
element.end.city_cn = city_cnTwo?city_cnTwo:@"";
NSLog(@"geocoderTwo--输出的省份:%@ --城市:%@ --区:%@",provinceTwo,districtTwo,city_cnTwo);
}
}
}];
//获取ID(用上面方法可解决首页点击历史记录地址的时候下面方法无法获取“省、市”的问题)
self.searchTwo = [[BMKGeoCodeSearch alloc] init];
self.searchTwo.delegate = self;
BMKReverseGeoCodeSearchOption *reverseGeoCodeOptionTwo = [[BMKReverseGeoCodeSearchOption alloc]init];
reverseGeoCodeOptionTwo.location = endLocation.coordinate;
reverseGeoCodeOptionTwo.isLatestAdmin = YES;
BOOL flagTwo = [self.searchTwo reverseGeoCode: reverseGeoCodeOptionTwo];
if (flagTwo) {
NSString *city_codeTwo = self.adCodeTwo;
element.end.city_code = city_codeTwo?city_codeTwo:@"";
NSLog(@"searchTwo输出城市的区id:%@",city_codeTwo);
}
return element;
}
// 逆编码结果![WechatIMG40.png](https://upload-images.jianshu.io/upload_images/1389082-5f944516652e618c.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
![WechatIMG677.png](https://upload-images.jianshu.io/upload_images/1389082-c0c164f49bbef5f5.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
- (void)onGetReverseGeoCodeResult:(BMKGeoCodeSearch *)searcher result:(BMKReverseGeoCodeSearchResult *)result errorCode:(BMKSearchErrorCode)error {
if (error == BMK_SEARCH_NO_ERROR) {
if (searcher == self.search) {
self.adCode = result.addressDetail.adCode;
NSLog(@"adCode返回结果:%@",self.adCode);
} else if (searcher == self.searchTwo) {
self.adCodeTwo = result.addressDetail.adCode;
NSLog(@"adCodeTwo返回结果:%@",self.adCodeTwo);
}
} else {
NSLog(@"检索失败");
}
}
4.Xcode控制台po打印不出值
5.播放本地音频(链接未作修改参考-司机端项目)
http://www.manongjc.com/detail/18-yeryepazaqinqly.html
http://www.voidcn.com/article/p-ppjrohjg-bvr.html
https://blog.csdn.net/wlm0813/article/details/51170574
https://blog.csdn.net/u012265444/article/details/52278016
6.比较两个日期(写到1的时间里面去-司机端-链接参考)
https://www.jianshu.com/p/381d9f7c708f
https://www.jianshu.com/p/6791ed54625c
7.百度地图的聚合及范围显示功能(链接未作修改参考-司机端项目)
https://www.jianshu.com/p/58eaeeb41df9?utm_campaign=maleskine&utm_content=note&utm_medium=seo_notes&utm_source=recommendation
https://blog.csdn.net/ago_lei/article/details/51427132
https://blog.csdn.net/yangmeng13930719363/article/details/50396965?locationNum=15
https://www.jianshu.com/p/0d03f8731eaf?utm_campaign=maleskine&utm_content=note&utm_medium=seo_notes&utm_source=recommendation
https://blog.csdn.net/demoker/article/details/37694841
https://www.jianshu.com/p/771fee182f6a
https://www.jianshu.com/p/9f0fd80bcbda?utm_campaign=maleskine&utm_content=note&utm_medium=seo_notes&utm_source=recommendation
8.打包上架用Transporter(链接未作修改参考)
https://blog.csdn.net/u013306324/article/details/106931692/
9.计算路径规划距离(链接未作修改参考-司机端项目)
https://blog.csdn.net/u010105969/article/details/72457960
https://github.com/cnsponmas/BMKUtil
10.iOS解决H5支付跳转到支付App及返回原App问题(链接未作修改参考-司机端项目)
https://www.jianshu.com/p/426fffed2ab2
https://blog.csdn.net/ywm04050712/article/details/103958953
iOS 浮点数的精确计算和四舍五入问题
https://www.jianshu.com/p/946c4c4aff33
如何处理target has frameworks with conflicting names: xx.framework错误
https://www.jianshu.com/p/a142d6bee8bf
DoraemonKit(一款功能齐全的客户端( iOS 、Android、微信小程序、Flutter )研发助手,你值得拥有)
https://github.com/didi/DoraemonKit
11.使用IQKeyBoardManger 键盘弹出时导航栏也移动的问题
https://ask.csdn.net/questions/249937
12.RAC(ReactiveCocoa)——基本使用
https://www.jianshu.com/p/bfb8f1e2766e
13.在现有工程中实施基于CTMediator的组件化方案
https://casatwy.com/modulization_in_action.html
14.UITableViewCell超出cell部分的控件如何显示
https://www.cnblogs.com/cmt/p/14553189.html
15.广告位接入(穿山甲+优量汇)
穿山甲:https://www.pangle.cn/union/media/union/download/detail?id=16&docId=5fbcfaf27b550100157bfddf&osType=ios
优量汇:http://developers.adnet.qq.com/doc/ios/union/union_embed
16.如何删除SceneDelegate(可以结合写的包进行记录)
https://blog.csdn.net/weixin_43864837/article/details/104232482