iOS常见错误整理

版权声明:本文为博主原创文章,如若转载请注明博客来源以及地址,多谢 https://blog.csdn.net/xiaoluodecai/article/details/50617193

iOS常见错误分析:(持续更新)

2016.01.30

1.

出现错误:虚拟机Xcode调试时候发现点击键盘出不来,命令行打印:

Can't find keyplane that supports type 8 for keyboard iPhone-Portrait-DecimalPad; using 3648623971_Portrait_iPhone-Simple-Pad_Default

解决方法:通过Hardware->Keyboard->Toggle Software Keyboard手动激活键盘。

2.

出现错误:程序一运行就奔溃,但是我已经设置了storyboard的入口视图。 而且storyboard名字是Main命令行打印:

Failed to instantiate the default view controller for UIMainStoryboardFile 'Main' - perhaps the designated entry point is not set?

解决方法:因为给你的StoryBoard没有设置默认显示的controller。

解决网址:Failed to instantiate the default view controller.

3.

出现错误:出现这个警告,命令行打印:

Null passed to a callee that requires a non-null argument

解决方法:其实错误发生在:
我错误地写成了DISPATCH_QUEUE_PRIORITY_DEFAULT
正确应该dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0)
从这里可以看出,xcode的警告不能忽略,而且要先从英文去理解意思先;

4.

出现错误:编译出错,命令行打印:

local declareation “XXX” hide instance variable

解决方法:程序中有重名的变量,找出重名的变量并进行修改。

5.

出现错误:在编写类的初始化函数时出现以下错误,命令行打印:

Cannot assign to 'self' outside of a method in the init family

源代码:

- (id) Myinit{
  self = [super init];
  ……
}

解决方法:

- (id) initWithMy
{
  self = [super init];
}

2016.01.30

2.

出现错误:
UIScrollView无法滚动

可能原因:

(1)没有设置contentSize

(2)scrollEnabled = NO

(3)没有接收到触摸事件:userInteractionEnabled = NO

(4)没有取消autolayout功能(如果在Storyboard中添加了ScrollView的子控件,要想scrollView滚动,必须取消autolayout).

2.

出现错误:下载图片时发现警告
命令行打印:

App Transport Security has blocked a cleartext HTTP (http://) resource load since it is insecure. Temporary exceptions can be configured via your app's Info.plist file.

解决方法:在iOS9 beta1中,苹果将原http协议改成了https协议,使用 TLS1.2 SSL加密请求数据。
在info.plist中添加

<key>NSAppTransportSecurity</key><dict>
<key>NSAllowsArbitraryLoads</key>
<true/></dict>

解决网址:[http://www.cocoachina.com/bbs/read.php?tid-307066-keyword-xcode7.html
](http://www.cocoachina.com/bbs/read.php?tid-307066-keyword-xcode7.html
).

2016.01.30

1.

出现错误: 添加友盟时发现错误:
命令行打印:

does not contain bitcode. You must rebuild it with bitcode enabled (Xcode setting ENABLE_BITCODE), obtain an updated library from the vendor, or disable bitcode for this target. for architecture armv7

解决方法:由于Xcode自身的一些小问题,运行项目时一直报错 错误1的内容.然后我就检查项目友盟这个库的依赖呀.非常肯定的确认库已经导入而且在链接的二进制库里面.(就是build phases里面).然后就不断的重新导入clean了好多次还是不行.然后我就崩溃了.. 后来把Xcode重启再次运行真正的错误终于浮出水面(毕竟Xcode是beta版).就是错误2的内容.原来是友盟的二进制库不支持bitcode.而Xcode默认是要支持bitcode的,而且如果支持的话,其中所有的二进制库和framework都必须包含bitcode.至于什么是bitcode,请看这里:
http://blog.csdn.net/soindy/article/details/48518717

**解决网址:**bitcode关掉:
http://my.oschina.net/u/2407613/blog/509682?p={{page}}

2.

出现错误:
命令行打印:

[UIImageView CGImage]: unrecognized selector sent to instance 0x1783e5b00

*解决方法: UIImageView is not a UIImage ,代码拼写错误;

猜你喜欢

转载自blog.csdn.net/xiaoluodecai/article/details/50617193