项目开发中遇到的一些问题纪录

一, iPhone手机升级最新系统后,Xcode在真机上编译运行时,可能会报错提示Could not find Developer Disk Image

原因是Xcode的DeviceSupport里面缺少了最新的iOS版本的SDK. 

解决办法:

  1. 越新越好,更新Xcode到最新版本,但速度着实让人抓狂,没有耐性和时间可以放弃了。
  2. 缺啥补啥,直接把缺少的SDK导进去。

步骤如下:

  • 打开Finder
  • 找到应用程序文件夹
  • 在里面找到XCode
  • 点击XCode,右键,显示包内容
  • Contents-->Developer-->Platforms-->iPhoneOS.platform-->DeviceSupport
    /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport
  • 然后你就能看到你的Xcode支持的真机测试的一些系统型号对应的文件
  • 把你找到的最新的iOS版本的SDK拖进去
  • http://pan.baidu.com/s/1qWIfrqc
参考: http://www.jianshu.com/p/a11ac42f75c3

二,UIbutton 按钮加图片后文字显示不出来解决方案

要在button上加图片,并且图片上显示button文字,应设置背景图片

[btn setBackgroundImage:[UIImage imageNamed:@"arrow.png"]forState:UIControlStateNormal];

而不是 [btn setImage:[UIImage imageNamed:@"arrow.png"] forState:UIControlStateNormal];

三, 用xib或storyboard时,有时候会编译报警告Automatic Preferred Max Layout Width is not available on iOS versions prior to 8.0

This warning can also be triggered by labels that have numberOfLines set to anything but 1 if your deployment target is set to 7.1. This is completely reproducible with new single-view project.

Steps to Reproduce:

  1. Create a new single-view, objective-c project 
  2. Set the Deployment Target to 7.1
  3. Open the project's storyboard
  4. Drop a label onto the provided view controller
  5. Set the numberOfLines for that label to 2.
  6. Compile



四,改变scrollView方法setContentOffset的滚动速度

- (void)setContentOffset:(CGPoint)contentOffset animated:(BOOL)animated;

animated设为YES时的滚动默认时间可能较长,要更改滚动速度可用

[UIView animateWithDuration:2.0 animations:^{
 scrollView.contentOffset = CGPointMake(x, y);
}];

同时setContentOffSet: animation: 有时候有卡顿,所以写此方法

-(void)setBgContentOffsetAnimation:(CGFloat )OffsetY
    {  [UIView animateWithDuration:.25 animations:^
    {
    bgScrollView.contentOffset = CGPointMake(0, OffsetY);
    }];
    }

 出现这种情况的原因有很多

    1:runloop 中原因 系统为了资源禁用了动画 和其他事件的接收

    2:短时间多次调用此方法 系统取消了动画

    3:跟其他动画冲突

 参看   http://codego.net/229277/


五,Xcode7中定位EXC_BAD_ACCESS的debug功能

EXC_BAD_ACCESS一直是很多开发者的噩梦,因为这个错误很不直观,出现后往往要花很长时间才能定位到错误。苹果这次带来了革命性的提升。

在项目的Scheme中Diagnostics下,选中enable address sanitizer(注意选中后Xcode会重新编译整个项目)。


这样设置后,如果再出现类似的错误会有更详细的错误信息提示,甚至会有内存使用情况的展示。

参看:http://www.jianshu.com/p/70ed36cf8a98


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值