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

庆阳网站设计公司海外推广有前途吗

庆阳网站设计公司,海外推广有前途吗,如何做app软件开发,html登录界面设计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.huolong8.cn/news/164965/

相关文章:

  • 网站禁止右键代码wordpress语言更换
  • wordpress建站连接数据库seo平台怎么样
  • 网站横幅怎么做网站推广软件下载安装免费
  • 网站英文域名怎么查重庆网站建设慕枫
  • 做学校后台网站用什么浏览器wordpress域名替换
  • 手机网站推荐大全北京公司摇号政策
  • 株洲网站建设设计专家一对一免费咨询
  • 上海网站设计开发公自己公司内网网站和外网怎么做同步
  • 漯河优惠网站建设价格大型旅游网站源码 织梦
  • 一个域名建多个网站苏州做网站公司乛 苏州聚尚网络
  • wordpress 修改文章seo更新网站内容的注意事项
  • 重庆模板建站公司wordpress主题范例
  • 阜阳做网站哪家好怎样才能被百度秒收录
  • 建设银行网站功能介绍网页制作和设计实验目的
  • 网站建设公司平台动漫设计与制作专业学什么
  • 常用网站开发语言太原网页制作公司
  • 嘉兴 企业网站 哪家为什么建设网银网站打不开
  • 做网站需要服务器吗深圳网站建设 公司元
  • 宿州做网站电商哪个平台销量最好
  • 网站后台管理系统下载wordpress顶部图像修改
  • 蒙狼科技建设网站好不好福州网站设计外包
  • 福田网站建设设计公司哪家好wap网站 html5
  • 用tomcat做网站目录典型的o2o平台有哪些
  • sns电商网站114网址大全
  • 凡科网做网站教程php网站开发学校
  • 扬州有做义工的地方或网站嘛wordpress最大上传2g
  • dz网站如何搬家优惠劵精选网站怎么做
  • 领导视察网站建设wordpress如何实现登录注册功能
  • 免费asp主机网站wordpress双语模板
  • 网站建设空格怎么打wordpress 文章找不到