iOS - Xcode 10 和 iOS 12 问题集合

1、运行时报错如下错:

log 打印
1
2
3
4
5
Showing Recent Messages:-1:Multiple commands produce'/Users/edison/Library/Developer/Xcode/DerivedData/$(product name)-fxzbpoappydriwfozeeqaxxcyoho/Build/Products/Debug-iphoneos/$(product name).app':

1) Target '$(product name)' has create directory command with output '/Users/edison/Library/Developer/Xcode/DerivedData/$(product name)-fxzbpoappydriwfozeeqaxxcyoho/Build/Products/Debug-iphoneos/$(product name).app'

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

解决方法:选中项目 target -> Build phase -> Copy Pods Resources -> Output Files -> 移除 ${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH} -> Build

2、README 文件重复问题

log 打印
1
2
3
4
5
6
7
8
Showing Recent Messages:-1: Multiple commands produce '/Users/edison/Library/Developer/Xcode/DerivedData/$(product name)-fxzbpoappydriwfozeeqaxxcyoho/Build/Products/Debug-iphoneos/$(product name).app/README.md':
1) Target '$(product name)' (project '$(product name)') has copy command from '/工程路径/.../README.md' to '/工程路径/.../README.md'

2) Target '$(product name)' (project '$(product name)') has copy command from '工程路径/.../README.md' to '工程路径/.../README.md'

3) Target '$(product name)' (project '$(product name)') has copy command from '工程路径/.../README.md' to '工程路径/.../README.md'

4) Target '$(product name)' (project '$(product name)') has copy command from '工程路径/.../README.md' to '工程路径/.../README.md'

解决方法:在工程内搜索 README,删除所有搜索结果。

Tips:除了 README.md 文件也可能是其他文件重复,都删除就好。

3、Info.plist 文件重复问题

log 打印
1
2
3
4
5
Multiple commands produce '/Users/jiaxiaoyan/Library/Developer/Xcode/DerivedData/LJShell-emaksjqtieseunfuiotagpjkluwp/Build/Products/Debug-iphonesimulator/Lianjia_Beike_SecondHand_Private/Lianjia_HomeLink_House_Private.bundle/Info.plist':

1) Target 'Lianjia_Beike_SecondHand_Private-Lianjia_HomeLink_House_Private' has copy command from '/Users/jiaxiaoyan/Desktop/LJworkspace/repoWorkSpaceRootPath/mobile_ios/lianjia_ios_platc/Lianjia_Beike_SecondHand/Lianjia_Beike_SecondHand/Lianjia_Beike_SecondHand/Private/HousePrivate/LJSecondHandHouseComponent/HouseVideo/AliyunVodPlayerSDK.framework/Info.plist' to '/Users/jiaxiaoyan/Library/Developer/Xcode/DerivedData/LJShell-emaksjqtieseunfuiotagpjkluwp/Build/Products/Debug-iphonesimulator/Lianjia_Beike_SecondHand_Private/Lianjia_HomeLink_House_Private.bundle/Info.plist'


2) Target 'Lianjia_Beike_SecondHand_Private-Lianjia_HomeLink_House_Private' has process command with input '/Users/jiaxiaoyan/Desktop/LJworkspace/repoWorkSpaceRootPath/mobile_ios/lianjia_ios_platc/lianjia_ios_platc/Pods/Target Support Files/Lianjia_Beike_SecondHand_Private/ResourceBundle-Lianjia_HomeLink_House_Private-Info.plist'

原因:由于重复文件是其他部门有依赖,所以修改了xcode的配置暂时解决了编译报错的问题。

解决办法:菜单栏点击 File —> Workspace Settings —> Build System 选择 legacy Build System

043_01

4、Swift 桥接文件报错“Cannot find interface declaration for ‘类 B’,superclass of ‘类 A’”

问题分析:这个问题我看了很多博客和论坛问答, 但都没有找到合适的解决方法。已知的是在 swift 混编工程里导入 OC 库,在 Xcode 10 上会有这个 bug,而在 Xcode 9 上只需要在桥接文件中将报错的代码注释掉,编译成功恢复回来就可以解决问题。但 xcode 10 的中的桥接文件修改后每次编译都会恢复原样,无法用通用的方式解决。

解决方法:按着 Xcode 9 的思路,推测既然是桥接文件的问题,我就简单粗暴的新建了一个桥接文件:

043_02
043_03

然后编译一次,进入系统生成的 swift 桥接文件,把里面的代码全都复制到自己新建的桥接文件中:

043_04

然后在工程配置中把 swift 引用的头文件路径修改成自己创建的文件

043_05

运行一遍。

如果有报错,就把报错行注释,编译成功后恢复。问题解决。

------本文结束 感谢阅读------

本文地址:http://kaaaaai.cn/articles/043.html
本文基于 知识共享署名-相同方式共享 4.0 国际许可协议发布
转载请注明出处,谢谢!

众筹项目:拯救世界!
0%