iOS-我遇到的问题(三)

    1. libstdc++适配Xcode10与iOS12, 借鉴:libstdc++适配Xcode10与iOS12

报错:

library not found for -lstdc++.6.0.9
linker command failed with exit code 1 (use -v to see invocation)

拷贝缺失的libstdc++

XCode10目前是Beta版,和XCode9正式版可以共存,于是从XCode9的目录里,把缺失的.tbd文件拷贝过来,要记得拷贝2套,一套是模拟器的,一套是设备的,可以简单的用下面的命令

cp /Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/lib/libstdc++.* /Applications/Xcode-beta10.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/lib/
cp /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/usr/lib/libstdc++.* /Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/usr/lib/
    1. 重复文件报错(工程中存在多个相同的文件), 借鉴:Xcode10和iOS12踩坑(随时更新)

报错:

:-1: Multiple commands produce '/Users/xxx/Library/Developer/Xcode/DerivedData/xxx.app/cmath':
1) Target 'KingDraw' has copy command from '/Users/goodsrc/Desktop/公司项目/xxx/xxx/GKDLib/RDLib/include/boost/compatibility/cpp_c_headers/cmath' to '/Users/xxx/Library/Developer/Xcode/DerivedData/xxx.app/cmath'
2) Target 'xxx' has copy command from '/Users/xxx/Desktop/公司项目/xxx/GKDLib/RDLib/include/boost/tr1/tr1/cmath' to '/Users/xxx/Library/Developer/Xcode/DerivedData/xxx.app/cmath'

解决办法

第一种. 删除多余的或者改名字
第二种. 修改Xcode编译配置Xcode->File->Project Settings/Workspace Setting-> Build System -> Legacy Build System.

    1. git更新,缺失文件

报错:

Undefined symbols for architecture arm64:
  "_OBJC_CLASS_$_ChangePasswordController", referenced from:
      objc-class-ref in SidebarController.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

解决办法

git拉取代码时,ChangePasswordController.h文件更新到文件夹中,但是在Xcode文件列表中并没有ChangePasswordController.h这个文件

    1. 便利数组的同时又修改这个数组里面的内容,导致崩溃

报错:

Terminating app due to uncaught exception 'NSGenericException', reason: '*** Collection <__NSArrayM: 0x282112430> was mutated while being enumerated.'

解决办法

forin循环遍历可变数组,并对其进行增删操作。
使用enumerateObjectsUsingBlock遍历对可变数组进行增删操作

    1. 僵尸对象导致crash(Thread 1:EXC_BAD_ACCESS(code=EXC_I386_GPFLT))

你可能感兴趣的:(iOS-我遇到的问题(三))