iOS开发实践iOS测试发布相关iOS学习笔记

【iOS】开发过程中遇到的问题

2016-03-21  本文已影响788人  胖嘟嘟小团子

总结开发过程中遇到的各种问题,如有理解错误,欢迎指正,谢谢!持续更新中。。。

//释放NSTimer
[self.timer invalidate];
self.timer = nil;
//释放CADisplayLink
[self.displayLink invalidate];
self.displayLink = nil;
//释放通知中心(谁注册谁释放)
-(void)dealloc {
    [[NSNotificationCenter defaultCenter] removeObserver:self];
}
//Object-C:
-(BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch {
    if ([touch.view isDescendantOfView:subView])  {
        return NO;
    }
    return YES;
} 
//Swift:
func gestureRecognizer(gestureRecognizer: UIGestureRecognizer, shouldReceiveTouch touch: UITouch) -> Bool  {
    if touch.view.isDescendantOfView(subView){
        return false
    }
    return true
}
//Object-C
NSDictionary *info= [[NSBundle mainBundle] infoDictionary];
info[@"CFBundleShortVersionString"]; //Version
info[@"CFBundleVersion"]; //Build
//Swift
let info:NSDictionary! = NSBundle.mainBundle().infoDictionary
let version = info["CFBundleShortVersionString"];
let build = info["CFBundleVersion"];
print("version = \(version),build = \(build)")
rm -rf ~/Library/Developer/CoreSimulator/Devices
killall -9 com.apple.CoreSimulator.CoreSimulatorService
上一篇下一篇

猜你喜欢

热点阅读