XCode 内置了 OCUnit 单元测试框架,但目前最好用的测试框架应该是 GHUnit。通过 GHUnit + OCMock 组合,我们可以在 iOS 下进行较强大的单元测试功能。本文将演示如何在
2014-10-09 22:31
1006 查看
在iOS SDK 5.0中使用ARC之后,有些东西咱们还是得在对象销毁的时候做,比如说注销Observer什么的,这个时候还是得重写dealloc方法。但是调用[super dealloc]时系统会提示ARC forbids
explicit message send of ‘dealloc’,怎么办呢?
根据苹果官方文档(https://developer.apple.com/library/ios/#releasenotes/ObjectiveC/RN-TransitioningToARC/Introduction/Introduction.html)的精神,我们无需在重写的dealloc中添加[super dealloc],因为sdk在编译的时候会自己添加上去。
官方文档相关描述如下:
You may implement a
to manage resources other than releasing instance variables. You do not have to (indeed you cannot) release instance variables, but you may need to invoke
Custom
call to
a compiler error). The chaining to super is automated and enforced by the compiler.
explicit message send of ‘dealloc’,怎么办呢?
根据苹果官方文档(https://developer.apple.com/library/ios/#releasenotes/ObjectiveC/RN-TransitioningToARC/Introduction/Introduction.html)的精神,我们无需在重写的dealloc中添加[super dealloc],因为sdk在编译的时候会自己添加上去。
官方文档相关描述如下:
You may implement a
deallocmethod if you need
to manage resources other than releasing instance variables. You do not have to (indeed you cannot) release instance variables, but you may need to invoke
[systemClassInstance setDelegate:nil]on system classes and other code that isn’t compiled using ARC.
Custom
deallocmethods in ARC do not require a
call to
[super dealloc](it actually results in
a compiler error). The chaining to super is automated and enforced by the compiler.
相关文章推荐
- python的unittest框架中如何删除测试数据,清理环境,可以通过addCleanup函数
- 如何通过Xcode 5中集成的XCTest框架进行简单的单元测试
- Xcode 5 单元测试(二)OCMock和GHUnit
- 腾讯开放的测试框架,mark一下先,目前只把玩了demo,功能很强大
- iOS开发那些事--OCUnit测试框架
- Xcode 5 单元测试(二)OCMock和GHUnit
- iOS单元测试GHUnit + OCMock(使用cocoapods版)
- “复合设备(Compound Device)”可以占用多个地址。所谓复合设备其实就是把多个功能设备 通过内置的USB HUB 组合而成的设备,比如带录音话筒的USB 摄像头
- iOS开发那些事--OCUnit测试框架
- 通过beego快速创建一个Restful风格API项目及API文档自动化 本文演示如何快速(一分钟内,不写一行代码)的根据数据库及表创建一个Restful风格的API项目,及提供便于在线测试API的界
- iOS开发工具-如何使用网络封包分析工具Charles,通过配置proxy对http、https、tcp、udp 等协议的请求响应过程交互信息进行分析、判断、解决我们移动开发中的遇到的各种实际问题。
- Xcode6下iOS单元测试——XCTest和GHUnit框架简介和比较
- 在页面中,我们经常看到,一个button按钮,如果属标点击,就会触发一个窗口的显示,如果二次点击并可以隐藏,那么如何通过JAVA配合html来实现这一功能呢?
- GHUnit使用指南(翻译自GitHub)-IOS测试框架
- iOS开发 简述使用OCUnit对程序进行单元测试(UnitTest)
- iOS进行单元测试OCUnit+xctool
- Cocoapods + GHUnit + OCMock 实现iOS单元测试
- iOS开发中使用OCUnit进行单元测试
- iOS单元测试GHUnit + OCMock(不使用cocoapods版)
- 当Xcode大于等于8时,如何使用Appium Desktop 获取iOS APP控件的id进行自动化测试