iOS 遇到的问题总结(持续更新)

1. Invalid bitcode signature

image.png
背景:

我是拿iPhone 4s (iOS 8.1) 真机跑项目,报这个错,iPhone 5s (iOS8) 没有问题,就猜测是因为iPhone 4s是32位的原因,花了两天时间,最后删除Derived Data里的数据就好了,真是坑坑爹,后面看到一句话是这么说的:
Xcode无提示解决方案就可以删除/Users/用户名/Library/Developer/Xcode/DerivedData 路径下的缓存文件,重启xcode即可
万能的解决方案,这个Error还真是没有任何更详细的提示。

解决方案:

删除/Users/用户名/Library/Developer/Xcode/DerivedData 路径下的缓存文件,重启xcode即可

2. 弹窗弹不出来,或者一闪而过

背景:

使用了keywindow,并且采用这样的方式获取keywindow

 [UIApplication sharedApplication].keyWindow]

这边要说明一下,keywindow真的要慎用,如果用系统的UIAlertView弹窗,苹果是又重新创建了一个UIWindow作为keywindow,这个时候你再取keywindow就只能取到UIAlertControllerShimPresenterWindow,如下图的

iOS 遇到的问题总结(持续更新)_第1张图片
image.png

根据这个window再取当前控制器的时候,就会取出UIAlertController,如下图:

image.png
解决方案:
用[UIApplication sharedApplication].delegate.window 代替 [UIApplication sharedApplication].keyWindow]

注:[UIApplication sharedApplication].delegate.window 取的是你AppDelegate设置的window,必须要有这个window,要不然点不出来,如下图

Appdelegate.h


Appdelegate.h

Appdelegate.m


iOS 遇到的问题总结(持续更新)_第2张图片
Appdelegate.m

3. iPhone has denied the launch request

iOS 遇到的问题总结(持续更新)_第3张图片
image.png
解决方案:

code sign issue. Make sure you're signing with developer, not distribution.You need indeed to use an "iOS Development" provisioning profile.

3. 安装Cocoapods的时候报错Not a directory - /usr/local/bin/fuzzy_match

解决命令:
$ gem env
$ sudo gem install --user-install cocoapods
Cocoapods ERROR: While executing gem … (Errno::ENOTSUP)

你可能感兴趣的:(iOS 遇到的问题总结(持续更新))