编译运行错误汇集

1、error: can't allocate region

  死循环导致内存不足

2、wait_fences: failed to receive reply: 10004003  (还没有找到原因) 

3、 file is universal (3 slices) but does not contain a(n) armv7s slice

  Target --> Build Settings --> Valid Architectures 把 armv7s 删除掉即可。

4、Redefinition of enumerator 'class'

  一般都是导入文件有误导致。

5、link directory not found 

  (e.g., facebook sdk, 则要修改下面的路径 )

6、"No previous prototype for function"

  a、方法上加上修饰符static
      b、Project-Info --> TARGETS --> Build Settings --> LLVM GCC4.2 - Warnings --> Missing Function Prototypes YES --> NO

7、failed to launch '/Users/xxx/Library/Developer/Xcode/DerivedData/MyApp-aaaaaa.../Build/Products/Debug-iPhones/MyApp.app/MyApp' -- No such file or directory

  a、remove the app from the device
      b、remove the contents of the DerivedData folder
      c、Clean & Build the project, restart Xcode, and reboot your device

8、ld: warning: directory not found for option '-F…' OR ld: warning: directory not found for option '-L…'

  a) 选择工程, 编译的 (targets)
      b) 选择 Build Settings 菜单
      c) 查找 Library Search Paths 和 Framework Search Paths, 删掉编译报warning的路径即OK

9、iOS真机调试出现 Command /usr/bin/codesign failed with exit code 1

  查看详细信息提示:CSSMERR_TP_NOT_TRUSTED

  查了点资料,发现原来之前在keychain(钥匙窜访问)中多删了一个证书:Apple Woldwide Developer Relations Certification Authority,它是iPhone Developer证书的签发者,如果它被删除就会导致iPhone Developer证书被识别为未知颁发机构签名,然后xcode中真机调试就会出现上面的错误。解决方法当然是重新把AppleWWDRCA放回去。

  apple下载地址 找到 Woldwide Developer Relations 选择 Download certificate。

  下载后拖入keychain(钥匙窜访问)-登录目录。

10、linker command failed with exit code 1 (use -v to see invocation)     xxx.o

  原因一:import xxx.m文件。
      原因二:xxx.h和xxx.m是拖进Project的,所以没有记录在setting的build phase。

11、CopyPNGFile, pngcrush caught libpng error:   Not a PNG filCould not find file:

  原因:假设有一张叫a.gif的图片,被直接强行改了名字为a.png
      解决方法:打开图片重新按png格式保存过。

 12、No provisioning profiles with a valid signing identity (i.e. certificate and private key pair) were found.

  情况:其他的 app 时能正常的 load 到设备上运行的,就只有一个 app 不可以。  

  原因:Build Settings -> Code Signing -> Provisioning Profile 选择了 发布的 profile了。

  解决方法: 选择 None。

13、Xcode5.1 编译运行没有问题,profile 的时候出错 “missing required architecture x86_64 in file

  解决方法:

    a) Building Settings -> "Validate Architecture" = arm64 armv7 armv7, 把 arm64  删掉即可。

    b) Architecture 也要改为 $(ARCHS_STANDARD_32_BIT)

14、could not build module foundation 错误

  解决方法:.pch 文件开始的地方加入 #ifdef __OBJC__  结束时加入 #endif。

#ifndef XXX_PrefixHeader_pch
#define XXX_PrefixHeader_pch

#ifdef __OBJC__
#import "A.h"
#import "B.h"
#endif

#endif

  

原文地址:https://www.cnblogs.com/eileenleung/p/3505131.html