iOS 错误积累

  • 记录一些iOS 项目运行时的错误
  • 把所有错误累计起来,已被以后查看

一、项目运行不了

Failed to initiate service connection to simulator Error returned in reply: Connection invalid

image.png

解决办法:需要关闭所有不同版本的xcode还有模拟器,重新打开运行就行

二、添加文件或者第三方库出错

linker command failed with exit code 1 (use -v to see invocation)

  • 1、首先排查项目中是否有名字重复的文件;

结合我的以上的报错情况,查看项目中是否不止一个ViewController文件

  • 2、检查是否在#import头文件的时候,错把.h写成了.m

通过Xcode的过滤查询功能,我很很快就修正了错误。

三、引入ARC库

iOS 报错:cannot create weak reference in file using
解决办法:
点击工程启动文件 - TARGETS -Build Settings - 在下方搜索框搜索weak - 在Apple LLVM 8.0 - Language - Objective C选项下边 - 把Weak Reference in Manual Retain Release选项改成YES即可。
image.png

# iOS, 工具
Your browser is out-of-date!

Update your browser to view this website correctly. Update my browser now

×