当前位置: 首页 > news >正文

怎么做网站埋点怎样免费做公司网站

怎么做网站埋点,怎样免费做公司网站,搜索网址的浏览器,品牌注册查询系统2016.05.05 18:34* 字数 861 阅读 5127评论 0喜欢 17https://www.jianshu.com/p/3072e174554fNSAssert和NSParameterAssert在开发环境中经常被使用#xff0c;调试和验证代码参数的完整性#xff0c;断言为真#xff0c;则表明程序运行正常#xff0c;而断言为假#xff0… 2016.05.05 18:34* 字数 861 阅读 5127评论 0喜欢 17 https://www.jianshu.com/p/3072e174554f NSAssert和NSParameterAssert在开发环境中经常被使用调试和验证代码参数的完整性断言为真则表明程序运行正常而断言为假则意味着它已经在代码中发现了意料之外的错误。xCode中的断言在Debug模式默认是开启的Realse版本中是禁用的. 基础断言 基础类库中了两种断言NSAssert和NSParameterAssert是OC断言NSCAssert和NSCParameterAssert是C语言断言。先来看一下NSAssert定义:precodeThe NSAssert macro evaluates the condition and serves as a front end to the assertion handler. Each thread has its own assertion handler, which is an object of class NSAssertionHandler. When invoked, an assertion handler prints an error message that includes the method and class names (or the function name). It then raises an NSInternalInconsistencyException exception. If condition evaluates to NO, the macro invokes handleFailureInMethod:object:file:lineNumber:description: on the assertion handler for the current thread, passing desc as the description string. This macro should be used only within Objective-C methods. Assertions are disabled if the preprocessor macro NS_BLOCK_ASSERTIONS is defined. **Important:Important** Do not call functions with side effects in the condition parameter of this macro. The condition parameter is not evaluated when assertions are disabled, so if you call functions with side effects, those functions may never get called when you build the project in a non-debug configuration. **Note:Note** Not all release configurations disable assertions by default./code/preNSParameterAssert的定义:preAssertions evaluate a condition and, if the condition evaluates to false, call the assertion handler for the current thread, passing it a format string and a variable number of arguments. Each thread has its own assertion handler, which is an object of class NSAssertionHandler. When invoked, an assertion handler prints an error message that includes method and class names (or the function name). It then raises an NSInternalInconsistencyException exception. This macro validates a parameter for an Objective-C method. Simply provide the parameter as the condition argument. The macro evaluates the parameter and, if it is false, it logs an error message that includes the parameter and then raises an exception. Assertions are disabled if the preprocessor macro NS_BLOCK_ASSERTIONS is defined. All assertion macros return void. **Important:Important** Do not call functions with side effects in the condition parameter of this macro. The condition parameter is not evaluated when assertions are disabled, so if you call functions with side effects, those functions may never get called when you build the project in a non-debug configuration. **Note:Note** Not all release configurations disable assertions by default./pre两者的定义类似大概意思就是如果是false就会调用当前线程Assertion Hanlder进行处理非Debug模式下可能所有的断言都不会调用最后一句很重要并不是所有的发布配置会禁用断言如果想看断言是否禁用需要看一下设置: Snip20160505_1.png 简单测试:precodeNSString *result中山郎;NSInteger count10;NSAssert(count10, 总数必须大于10);NSLog(断言执行之后);   /code/pre 崩溃信息 precode** FECategory[23811:248235] *** Assertion failure in -[ViewController setupAssert], /ViewController.m:45**** FECategory[23811:248235] *** Terminating app due to uncaught exception NSInternalInconsistencyException, reason: ****总数必须大于****10**/code/pre NSAssertionHandler NSAssert异常处理的时候默认是NSAssertionHandler处理的不过我们可以自定自己的Handler实现两个方法:precode (void)handleFailureInMethod:(SEL)selector object:(id)object file:(NSString *)fileName lineNumber:(NSInteger)line description:(nullable NSString *)format,... NS_FORMAT_FUNCTION(5,6);(void)handleFailureInFunction:(NSString *)functionName file:(NSString *)fileName lineNumber:(NSInteger)line description:(nullable NSString *)format,... NS_FORMAT_FUNCTION(4,5);/code/prehandleFailureInMethod处理OC方法中的断言handleFailureInFunction处理C函数中的断言自定义继承自NSAssertionHandler的类FEAssertionHandlerprecodeimplementation FEAssertionHandler -(void)handleFailureInMethod:(SEL)selector object:(id)object file:(NSString *)fileName lineNumber:(NSInteger)line description:(NSString *)format, ...{NSLog(FlyElephant-FEAssertionHandler: Method % for object % in %--line:%li, NSStringFromSelector(selector), object, fileName, (long)line);} -(void)handleFailureInFunction:(NSString *)functionName file:(NSString *)fileName lineNumber:(NSInteger)line description:(NSString *)format, ...{NSLog(FlyElephant-FEAssertionHandler:Function (%) in %--line:%li, functionName, fileName, (long)line);} end/code/pre AppDelegate中设置断言处理: precode (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {// Override point for customization after application launch.FEAssertionHandler *hanlder[[FEAssertionHandler alloc]init];[[[NSThread currentThread] threadDictionary] setValue:hanlder forKey:NSAssertionHandlerKey];return YES;} 转载于:https://www.cnblogs.com/sundaysgarden/p/10354170.html
http://www.zqtcl.cn/news/155830/

相关文章:

  • 网站建设技术合同模板下载怎么用phpstudy做网站
  • 青岛网站建设找二维码生成器怎么弄
  • 百度突然搜不到我的网站网络安全软件有哪些
  • 江阴做网站的地方网站维护需要的知识
  • 做网站是域名怎么申请网页设计跟做网站一样吗
  • 叮当快药网站谁做的网站开发遇到的最大困难
  • 一个域名可以建几个网站毕业设计可以做哪些简单网站
  • 知名商城网站建设报价wordpress 后台 logo
  • 单位网站建设框架yellow网站推广联盟
  • html5和php做网站做网站租用服务器
  • 网站开发中效率较高的编程语言公司域名注册流程
  • 万户网站管理系统4.0cms监控系统手机版下载
  • 宁波专业网站建设怎么做如何做一个虚拟网站
  • 网站栏目建设调研公司怎么建立一个网站
  • 苍溪建设局网站网站建设和维护采购协议
  • 代做网站微信号下载 wordpress插件
  • 泉州住房建设局网站wordpress输入html代码
  • 为什么访问外国网站速度慢沈阳网站公司排名
  • 网站建设+泰安网站项目建设策划方案
  • 微信人生里面微网站怎么做wordpress 第三方登录 代码
  • 做商城网站哪里高端大气网站案例
  • 网站做项目网站设计公司深
  • 学校做网站及费用建设网站有何要求
  • 河北邢台移动网站建设宁波网站开发公司电话
  • 免费建立个人网站申请seo搜索引擎优化推广
  • 如何拷贝服务器里面网站做备份金融网站怎么做的
  • 什么网站做的比较好网上投资网站建设
  • 公司网站运营方案策划办网站怎么赚钱
  • 贾汪区建设局网站设计接单兼职网站
  • 东莞商城网站建设哪家便宜wordpress 插件路径