CocoaPods Bug
Use the $(inherited)
flag
1 | [!] The `MBPeopleBaseApp [Debug]` target overrides the `OTHER_LDFLAGS` build setting defined in `Pods/Target Support Files/Pods-MBPeopleBaseApp/Pods-MBPeopleBaseApp.debug.xcconfig'. This can lead to problems with the CocoaPods installation |
解决方法:1
Other link flag 添加 $(inherited)
Xcode Bug
自定义的代码片段存放位置
1 | ~/Library/Developer/Xcode/UserData/CodeSnippets |
Xcode 10 Multiple commands produce 报错解决
1 | target > Build phase > Copy Bundle Resource/Compile Sources,删掉第三方库中重复的 README.txt,LICENSE,Info.plist 文件 |
工程文件乱序
选中要整理的文件夹右键,点一下“Sort by Name”或者“Sort by Type”即可排序。
项目打不开 Failed to load project at ‘’ “,incompatible project version
打开 project.pbxproj
文件,修改 objectVersion = 48;
不知道填什么往低了填,或者在自己想买找
Xcode 不高亮
1 | cd Library/Developer/Xcode/DerivedData |
打开Playground提示打开失败,找不到合适的devices
1 | 1. Quit Xcode |
碰到Xib加载不出来,什么什么工程文件找不到,请看看引用有没有,没有的话加上就好了!
用Xcode 7.3打开一个Xcode 8创建的工程,编译时报错:xxx.storyboard(或者xxx.xib) The document “null” required Xcode 8.0 or later.点击xxx.storyboard(或者xxx.xib)时,弹出如图所示提示框。
解决方法是以源码的方式打开xxx.storyboard(或者xxx.xib),然后删除<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
这一行代码,就OK了。
程序报错
No architectures to compile for (ONLY_ACTIVE_ARCH=YES, active arch=x86_64, VALID_ARCHS=armv7 armv7s)
build 这个target的时候命令行报错。可以在 build setting 中,搜索bitcode,并吧 enable bitcode 设置为 NO.
CopyPngFile Error 报错
TARGETS -> Build Phases -> Copy Bundle Resources -> 删除灰色或红色的文件
Cannot find interface declaration for ‘xxxxViewController’, superclass of ‘xxxViewController’; did you mean ‘UIViewController’
这是因为 父类总出现了交叉引用 前去父类查看 然后改掉就好了
pathForResource nil的情况,而项目命名有该资源
可能没拷贝进bundle1
Xcode -> TARAGETS -> Build Phases -> Copy Bundle Resources -> 添加
‘Could not instantiate class named xxx’
比如 ‘Could not instantiate class named WKWebView’
解决方法1
Xcode -> TARAGETS -> General -> Linked Frameworks and Librarier ,点击“+”号添加相应的系统库 webkit.framework
添加新字体, info.plist也配置好了,就是无效
请检查 TARGETS -> Build Phases -> Copy Bundle Resources 中是否添加此资源 其他添加资源后无效也可参考此条解决方案
ld: library not found for -lxxx:
类似出现上面这种问题(我的问题出现在libWeChatSDK这个包) ld:library not found for -lXXX 的问题有可能是你的某个库的连接引用有问题, —–解决的办法就是在项目的target里,选中Link Binary With Libraries 里的.a或framework 取消再加入,就可以了 —–如果是拖拽进入工程的,那就删除,在拖一次.
ld: symbol(s) not found for architecture x86_64
依赖库未导入
tableview遇到这种报错failed to obtain a cell from its dataSource
是因为你的cell被调用的早了。先循环使用了cell,后又创建cell。顺序错了 可能原因:
- xib的cell没有注册
- 内存中已经有这个cell的缓存了(也就是说通过你的cellId找到的cell并不是你想要的类型),这时候需要改下cell的标识
UIView-Encapsulated-Layout-Width 错误
修改约束优先级即可解决
Swift 创建控制器时自带xib加载在iOS8崩溃的问题
项目中有部分跟随控制器一起创建出来的xib,在iOS8之外的系统运行正常,在iOS8下崩溃,找不到对应关系,一番网上搜索,终于找到解决办法1
2
3
4
5
6
7override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?) {
super.init(nibName: "AddressViewController", bundle: nil)
}
required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
原来在iOS8下,也需要给控制器的xib重写一下init 方法,只记得在自定义view的是时候用过,没想到这里也需要,特意加上,算是兼容手机系统
ios开发中,xib加载view,loadNibNamed方法奔溃原因之一
xib中某一属性在代码中已删除,但在xib中没有解除关联
-[__NSArray0 addObject:]: unrecognized selector sent to instance 0x7f8a40d039a0
造成原因是你使用[NSArray addObject]
,而不是[NSMutabeArray addObject]
;
添加了一个All Exceptions 出现停在线程队列的情况,点继续运行仍然可以运行,将该断点删除或者将里面的All改成Object-C也可以!
ios7下面用autolayout报错类似 *** Assertion failure in -[XXX layoutSublayersOfLayer:], /SourceCache/UIKit/UIKit-2935.138/UIView.
解决方案:在布局之后 加上 [super layoutsubviews]
[self lauoutifneed]
这两个方法。
there was an internal api error “—- xcode7,
解决: bulid settings -> packaging -> product name
不要写中文。。。。
linker command failed with exit code 1 (use -v to see invocation)
- 检查是否重复引用,或者依赖引用.h
- 检查某个属性是否重复定义
- 检查是否 import 错误,把
.m
引入了 555 - 查看报错信息详情,一般都会提示,观察一下重复引用的两个文件名,分析即可