iOS错误信息记录,不定时补充

编码的时候总会遇到各种各样的错误,在这里记录下,方便以后查找

1.//

ld: 6 duplicate symbols for architecture ×86_64

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

iOS错误信息记录,不定时补充_第1张图片

原因:

工程中导入了重复文件

解决方案:

删除多余的即可


2.//

ld: library not found for -lMJExtension

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

       并且使用cocoapods安装MJExtension之后出现下图警告

iOS错误信息记录,不定时补充_第2张图片

  原因:

使用 cocoapods 安装第三方库,我们不需要自己在 项目 --> target --> Build Settings -- > Search Paths 中配置相关文件的路径,pods 会自动为我们配置好

  解决办法:

  1. 按照上面报错的提示,我们“HEADER_SEARCH_PATHS” 这个复制下来。
  2. 然后找到   项目 --> target --> Build Settings  然后在右边的输入框中输入“HEADER_SEARCH_PATHS” ,查看搜索到的项对应的 Debug 和 Release 值,如果其中含有警告的第三方库内文件的路径,就把该路径删除,然后添加路径“$(inherited)”;如果其中没有路径,也把“$(inherited)”添加进去。
  3. 之后,再次运行就没问题了


#mark -- 17.03.18 更新

3.//

***/Image/[email protected] pngcrush caught libpng error:  Not a PNG file..

应用在在模拟器上调试一点问题没有,但一放到真机上调试就出现copypngfile 的错误,编译器报错信息如下:

While reading /Users/avepoint/Desktop/**/**/Image/[email protected] pngcrush caught libpng error:

   Not a PNG file..

Command /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/copypng emitted errors but did not return a nonzero exit code to indicate failure


CopyPNGFile /Users/avepoint/Library/Developer/Xcode/DerivedData/**-eapmjmcpwpwpvcazuqcyashswpze/Build/Products/Debug-iphoneos/**.app/hsj.png **/Image/hsj.png

    cd /Users/avepoint/Desktop/Melon/XMPPWorking_realPhone/**

    export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"

    /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/copypng -compress /Users/avepoint/Desktop/**/**/Image/hsj.png /Users/avepoint/Library/Developer/Xcode/DerivedData/**-eapmjmcpwpwpvcazuqcyashswpze/Build/Products/Debug-iphoneos/**.app/hsj.png

解决方案:

1.在build settings里把工程里的Compress PNG files设置为NO,问题解决,但这样设置以后,弄出来的ipa会很大。

2.mac中用preview(预览)打开出问题的png文件,然后重新导出png文件或者用photoshop把png图片保存为NOT INTERLACED(不交错)的,覆盖源文件。这样真机 调试时就没有错误了。


4.//

Undefined symbols for architecture x86_64:
  "_sqlite3_column_bytes", referenced from:
      -[FunctionDBManager getOneCacheWithName:] in FunctionDBManager.o

原因:

缺少sqlite3.td

解决方案:

在 TARGETS  -- Build Phases  -- Link Binary With Libraries 中添加 sqlite3.td


5.//

      "_OBJC_CLASS_$_WKWebView", referenced from:

             objc-class-ref in FirstViewController.o

原因:
缺少WebKit.framework
解决方案:
TARGETS  -- Build Phases  -- Link Binary With Libraries 中添加WebKit.framework


#mark -- 17.04.27 更新


6.//
   
openssl/asn1.h file not found

原因:支付宝的aliPay.SDK没有添加到工程或者该SDK文件路径错误

解决办法:在 Building Settings -> Search Paths -> Header Search Paths 里添加 aliPay.SDK(因为openssl/asn1.h就在这个文件夹里) 的路径进去就可以了



7.//   
        Failed to initiate service connection to simulator   
         unable to contact local DTServiceHub to bless simulator connection

         iOS错误信息记录,不定时补充_第3张图片

解决办法:重启电脑


8.//
    'CALayer position contains NaN: [187.5 nan]' *** First throw call stack:


原因:有地方设置的frame存在除以0的情况,
解决办法:对可能出现除0的地方做下预防


#mark -- 17.06.10 添加

9.//
     “xxxxxxx”couldn't be opened because there is no such file.
     无法给控件如Button 关联方法

iOS错误信息记录,不定时补充_第4张图片

这个问题的出现应该属于人品问题 (^U^)ノ~YO , 实际上应该是Xcode的bug,那应该怎么处理呢,有三种方法可以尝试一下:

1、先.删除 .h 和 .m 的关联,不是完全删除,然后清理一下工程 Product -> Clean,完全退出Xcode,重新打开Xcode,之后再重新添加文件,问题应该可以解决了,如图:

iOS错误信息记录,不定时补充_第5张图片

2、如果方法1不行,那么试试关机重合,基本也能好了;

3、什么,上面的方法都不行;退后,我要放大招了,请看图:

iOS错误信息记录,不定时补充_第6张图片


 !!!  请手动写出这个方法,然后再拖线关联。
出现这种问题基本只会有一个类受到影响,所以采用第三种方法后,其他的XIB文件还是想怎么拖就怎么拖。




你可能感兴趣的:(OC,Swift)