总结一些在使用xcode中遇到的问题及解决办法(不定时更新):
一.解决Xcode中http请求不能访问
xcode7:
在Info.plist中添加 NSAppTransportSecurity 类型Dictionary 。
在 NSAppTransportSecurity 下添加 NSAllowsArbitraryLoads 类型Boolean ,值设为 YES
xcode7.1:
在Info.plist中添加 App Transport Security Settings类型Dictionary 。
在 App Transport Security Settings下添加 Allows Arbitrary Loads类型Boolean ,值设为 YES
二.解决Xcode中arc与非arc之间的转换
非arc转变为arc:在控制开关中添加-fobjc-arc 以arc进行编译。
arc转变为非arc:-fno-objc-arc
三.解决Xcode中模拟器键盘与真实键盘的切换
快捷键:commond+shift+k
或者修改模拟器HardWare中KeyBoard的Connect HardWare KeyBoard:
四.解决Xcode中直接在IB连线代理、KVO传值问题
在ViewController.m中:
#import"LogOutViewController.h"
匿名类中:
@interfaceViewController ()
{
LogOutViewController *_log;
}
//直接使用故事版连线要使用该方法
-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
_log = segue.destinationViewController;
[_log addObserver:selfforKeyPath:@"str" options:NSKeyValueObservingOptionNew context:nil];
}
-(void)dealloc{
//里面不写移除的方法
}
在LogOutViewController.m中写上:
[selfremoveObserver:self.presentingViewController forKeyPath:@"str"];