nsstring

iOS NSLog error with Unicode characters

假如想象 提交于 2020-01-21 07:20:28
问题 Can anyone tell me the cause of the discrepancy for the following results ? completionHandler:^(NSArray *placemarks, NSError *error) { NSLog(@"\n placemarks%@", placemarks); Resulting: placemarks( "\U039b\U03b5\U03c9\U03c6\U03cc\U03c1\U03bf\U03c2 \U039a\U03cd\U03c0\U03c1\U03bf\U03c5 163, 16451 \U0391\U03c1\U03b3\U03c5\U03c1\U03bf\U03cd\U03c0\U03bf\U03bb\U03b7\U03c2, \U0395\U03bb\U03bb\U03ac\U03c2 @ <+37.90085408,+23.75654648> +/- 100.00m, region (identifier <+37.90085408,+23.75654648> radius

iOS NSLog error with Unicode characters

别说谁变了你拦得住时间么 提交于 2020-01-21 07:20:07
问题 Can anyone tell me the cause of the discrepancy for the following results ? completionHandler:^(NSArray *placemarks, NSError *error) { NSLog(@"\n placemarks%@", placemarks); Resulting: placemarks( "\U039b\U03b5\U03c9\U03c6\U03cc\U03c1\U03bf\U03c2 \U039a\U03cd\U03c0\U03c1\U03bf\U03c5 163, 16451 \U0391\U03c1\U03b3\U03c5\U03c1\U03bf\U03cd\U03c0\U03bf\U03bb\U03b7\U03c2, \U0395\U03bb\U03bb\U03ac\U03c2 @ <+37.90085408,+23.75654648> +/- 100.00m, region (identifier <+37.90085408,+23.75654648> radius

__unsafe_unretained NSString struct var

一笑奈何 提交于 2020-01-21 03:43:04
问题 I am trying to create a structure that has several different variable of different types in it. several of the types are of NSString, but trying to do this was causing an error ARC forbids Objective-C objects in structs or unions so having read about the error I see its sensible to add __unsafe_unretained before the NSString declaration, However I have no idea what the ramifications of this will be, I have had a quick read around and found this detailed post about the differences of __strong

WKWebview使用记录

浪尽此生 提交于 2020-01-20 16:35:22
1、WKWebview添加手势 UISwipeGestureRecognizer *swipe =[[UISwipeGestureRecognizer alloc]initWithTarget:self action:@selector(swipeAction)]; swipe.delegate = self; [wkWebView addGestureRecognizer:swipe]; // 允许多个手势并发 - (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer { return YES; } 2、WKWebview禁用弹簧滑动 wkWebView.scrollView.bounces = NO; 3、WKWebview被js调用 window.webkit.messageHandlers.<对象名>.postMessage(body:<数据>)//body中可以直接放js对象,也可以省略body - (void)userContentController:(WKUserContentController *

OpenCV学习-b

和自甴很熟 提交于 2020-01-20 07:59:36
OpenCV是开源计算机视觉和机器学习库。包含成千上万优化过的算法。项目地址:http://opencv.org/about.html。官方文档:http://docs.opencv.org/modules/core/doc/intro.html。OpenCV已支持OpenCL OpenGL,也支持iOS和Android。OpenCV的API是C++的,所以在iOS中最佳实践是将用到OpenCV功能写一层Objective-C++封装。这些封装把OpenCV的C++API转化为安全的Objective-C API。 模块 core:简洁核心模块,基本函数,基本数据结构 imgproc:图像处理模块,线性和非线性图像滤波,几何图像转换,颜色空间转换,直方图等。 video:视频分析模块,运动估计,背景消除,物体跟踪算法 calib3d:基本多视角几何算法,单体和立体相机的标定,对象姿势估计,双目立体匹配算法和元素的三维重建 features2d:包含了显著特征检测算法,描述算子和算子匹配算法 objdetect:物体检测和一些预定义的物体的检测(如人脸,眼睛,杯子,人,汽车等) ml:多种机器学习算法,如K均值,支持向量机和神经网络 highgui:简单易用接口,有视频捕捉,图像和视频编码功能,简单UI接口,iOS的是其中一个子集 gpu:GPU加速算法,iOS不可用 ocl

Proper way to convert char* to NSString without initWithCString?

别来无恙 提交于 2020-01-20 06:06:15
问题 I'm pulling a listing of results from a SQLite3 database into a UITableView . The code where I pull text from the database is like so: char *menuNameChars = (char *) sqlite3_column_text(statement, 1); NSString *menuName = [[NSString alloc] initWithUTF8String:menuNameChars]; NSLog(@"Retrieved %s,%@ from DB.", menuNameChars, menuName); When I use initWithUTF8String , sometimes the information is copied properly from the database. Sometimes though, the information is displayed properly from the

Proper way to convert char* to NSString without initWithCString?

落花浮王杯 提交于 2020-01-20 06:06:08
问题 I'm pulling a listing of results from a SQLite3 database into a UITableView . The code where I pull text from the database is like so: char *menuNameChars = (char *) sqlite3_column_text(statement, 1); NSString *menuName = [[NSString alloc] initWithUTF8String:menuNameChars]; NSLog(@"Retrieved %s,%@ from DB.", menuNameChars, menuName); When I use initWithUTF8String , sometimes the information is copied properly from the database. Sometimes though, the information is displayed properly from the

How to get an array of sentences using CFStringTokenizer?

落爺英雄遲暮 提交于 2020-01-20 02:44:35
问题 I've created an string tokenizer like this: stringTokenizer = CFStringTokenizerCreate( NULL , (CFStringRef)str , CFRangeMake(0, [str length]) , kCFStringTokenizerUnitSentence , userLocale); But how do I obtain those sentences now from the tokenizer? The CF String Programming Guide doesn't mention CFStringTokenizer or tokens (did a full-text search in the PDF). 回答1: Here is an example of CFStringTokenizer usage: CFStringRef string; // Get string from somewhere CFLocaleRef locale =

二进制重排的方案参考链接

﹥>﹥吖頭↗ 提交于 2020-01-19 17:42:59
原理,代码执行是pagefault会消耗性能,将order file提供给编译器,让它按给到的顺序来链接.o,从而减少pagefault次数 https://mp.weixin.qq.com/s/Drmmx5JtjG3UtTFksL6Q8Q https://www.jianshu.com/p/024b3d847fe0 https://www.lizenghai.com/archives/41858.html 如何获取启动时调用的那些方法( sanitizerCoverage ) https://blog.csdn.net/zhang14916/article/details/100924489 https://blog.csdn.net/chouju2014/article/details/100657380 出处: 配置:other c flag -fsanitize_coverage=func,trace_pc_guard https://github.com/yulingtianxia/AppOrderFiles //调用,直接停止统计并且写入到一个文件extern void AppOrderFiles(void(^completion)(NSString *orderFilePath)); // // AppOrderFiles.m // AppOrderFiles //

swfit 过滤手机号、座机号

北城以北 提交于 2020-01-19 15:01:23
今天要实现物流信息里面电话可以点击拨打。然而服务端用的快递100三方返回的内容,只有物流信息和时间,作为前端,我们改怎么知道一条物流信息里面有几个手机号,几个座机号。我是没辙了。用富文本实现可以点击拨打电话很简单,但是怎么样鞥呢过滤出来手机号和座机号呢,当然用正则过滤喽 奉上代码 //手机号 fileprivate let regexMobilePhoneStr = "\\d{11}" //固话 fileprivate let regexPhoneStr = "\\d{3,4}[- ]?\\d{7,8}" //用个for循环,写死3次,应该一条物流信息里面不会超过3个电话吧 //为什么这么写,我也没办法,谁让服务端不告诉我有几个手机号,或者把手机号单独返回给我们拼接更方便 for _ in 0...2 { var number = (contentLabelText as NSString).getStrWithRegex(regexMobilePhoneStr) if number.count == 0 { number = (contentLabelText as NSString).getStrWithRegex(regexPhoneStr) } let range = (contentLabelText as NSString).range(of: number) /