Xcode10趟坑之路

https://www.jianshu.com/p/12558d39ba08

先默念别有太多坑啊

跑起来吧

结果没有跑起来

1.第一个坑

 

Showing Recent Messages

:-1: Multiple commands produce '/Users/wanglei/Library/Developer/Xcode/DerivedData/JMTAPP-grwqpsineudpywaswwtdjudjpkwm/Build/Products/Debug-iphonesimulator/JMTAPP.app':

1) Target 'JMTAPP' has create directory command with output '/Users/wanglei/Library/Developer/Xcode/DerivedData/JMTAPP-grwqpsineudpywaswwtdjudjpkwm/Build/Products/Debug-iphonesimulator/JMTAPP.app'

2) That command depends on command in Target 'JMTAPP': script phase “[CP] Copy Pods Resources”

 


 

 

1

 

英语不好,隐约中感觉是跟Pod有关系,但是抓住了output 和[CP] Copy Pods Resources关键字,摸索一番之后,得到了解决办法

TARGETS --> Build Phases --> [CP] Copy Pods Resources --> Output Files 删除 ${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}

 


2

 

结果如下:

 

 
 

3

 

好的接着跑

2.第二个坑

Showing Recent Messages

:-1: Multiple commands produce '/Users/wanglei/Library/Developer/Xcode/DerivedData/JMTAPP-grwqpsineudpywaswwtdjudjpkwm/Build/Products/Debug-iphonesimulator/JMTAPP.app/Info.plist':

1) Target 'JMTAPP' (project 'JMTAPP') has copy command from '/Users/wanglei/Desktop/iosv2.1 2/JMTAPP/Info.plist' to '/Users/wanglei/Library/Developer/Xcode/DerivedData/JMTAPP-grwqpsineudpywaswwtdjudjpkwm/Build/Products/Debug-iphonesimulator/JMTAPP.app/Info.plist'

2) Target 'JMTAPP' (project 'JMTAPP') has process command with output '/Users/wanglei/Library/Developer/Xcode/DerivedData/JMTAPP-grwqpsineudpywaswwtdjudjpkwm/Build/Products/Debug-iphonesimulator/JMTAPP.app/Info.plist'

 

字面意思,说是info.plist 文件重复了

两种解决方案:

 

1 设置workspace

xcode -> file -> WorkSpace Settings ->BuildSystem -> 选择 Legacy Build System

 


 

4

 

 

2 删除info.plist 文件

TARGETS --> Build Phases --> Copy Bundle Resources --> 删除info.plist

 

 

3.第三个坑

犹豫项目比较老,很多第三方库不能用了

 

Pods/ObjectMapper/Sources/EnumOperators.swift:35:13: Invalid redeclaration of '<-'

 

 

5

 

红的报的我想哭

尝试更新第三方库试试

 

pod update ObjectMapper  --verbose --no-repo-update

 

pod update HandyJSON  --verbose --no-repo-update

 

 

4.第四个坑

ld: library not found for -lstdc++.6.0.9

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

 

项目里用了阿里百川的反馈,用了这个依赖库,

字面意思,缺失c++依赖库,苹果在XCode10和iOS12中移除了libstdc++这个库,由libc++这个库取而代之,

苹果的官方解释是libstdc++已经标记为废弃有5年了,建议大家使用经过了llvm优化过并且全面支持C++11的libc++库。

这个好解决,缺失库,我就从xcode9里面把这些库复制过来。

Xcode -> 显示包内容->Contents->Developer->Platforms->iPhoneOS.platform(模拟器是iPhoneSimulator.platform)->Developer->SDKS->iPhoneOS.sdk->usr->lib

然后真机运行,成功

5.第五个坑

继续上面的第四个坑啊,真机运行是OK的,但是模拟器运行,编译通过后却崩溃了。

 

6

 

看得出错提示说是.dylib与这个模拟器不符合。

这个问题,要么在Xcode10里面安装iOS11的模拟器运行环境,要么就是跟厂家联系,进行升级。

 

更新

找到了Xcode10模拟器和真机运行的办法了

1.将libstdc++_sim.zip解压,放到目录

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/usr/lib/

 

 

将 libstdc++.dylib_sim.zip 解压,放到目录

 

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/

 

总结

趟坑之路先写到这里,期间也遇到了以前同事写的代码过于臃肿,Xcode10识别不出来的问题,这都是小问题,就不赘述了,报的错误如下,有这个相似经历的,稍微修改一下就可以了。

The compiler is unable to type-check this expression in reasonable time; try breaking up the expression into distinct sub-expressions

 

欢迎各位大佬,批评指正和建议。

 

作者:王垒iOS

链接:https://www.jianshu.com/p/12558d39ba08

来源:简书

简书著作权归作者所有,任何形式的转载都请联系作者获得授权并注明出处。

 

posted @ 2019-04-03 15:31  sundayswift  阅读(810)  评论(0编辑  收藏  举报