iOS开发小问题集合

乱七八糟小问题集合,不定时更新。

Q:XCode10引入头文件不提示

xcode顶部菜单栏 > File > Workspace Settings > 修改下图两项


Workspace Settings.png

Q:运行报错 duplicate symbol OBJC_IVAR$_XXX in

ld: 7 duplicate symbols for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

此问题多年发生,99%的概率是以下问题:
1. 项目里有相同名字的类;
2. 引入头文件的时候,将".h"写成了".m";
这两种情况可以仔细排查,找出来改掉。

贴一张报错信息


报错信息.png
注意图中蓝色框框中有个地址信息,直接去访问,如果报错和图中一样,那这个地址中应该是有重复的文件,删除掉重复的。

当删除了重复文件,运行工程,发现依然不行,再去看地址文件夹,发现重复文件又出现了,说明问题不是出在这里,这里只是表现。
那问题出在哪里呢?
这时候可以去看下包内容,右键.xcodeproj文件,选择显示包内容,双击project.pbxproj文件,在文件内搜索上图中报错标出的文件名,如果有重复的内容,删除掉,再运行。
Build Successed!!!

【此报错的原因有非常非常多,以上只是最普遍的一种,如果很不幸不是,请耐心查询其他同学的分享】

Q:Command PhaseScriptExecution failed with a nonzero exit code

(自己的报错忘记保存了,贴一个别人的报错)
PhaseScriptExecution [CP]\ Embed\ Pods\ Frameworks /Users/douchuanwei/Library/Developer/Xcode/DerivedData/Runner-boibxjwkabvwbvdeeixuokeyedtq/Build/Intermediates.noindex/ArchiveIntermediates/Runner/IntermediateBuildFilesPath/Runner.build/Release-iphoneos/Runner.build/Script-9789307C689B8F1B8E4A8F86.sh (in target 'Runner' from project 'Runner')

cd /Users/douchuanwei/Desktop/shenlanai/shenlan-app/aiprestamo/ios

/bin/sh -c /Users/douchuanwei/Library/Developer/Xcode/DerivedData/Runner-boibxjwkabvwbvdeeixuokeyedtq/Build/Intermediates.noindex/ArchiveIntermediates/Runner/IntermediateBuildFilesPath/Runner.build/Release-iphoneos/Runner.build/Script-9789307C689B8F1B8E4A8F86.sh

mkdir -p /Users/douchuanwei/Library/Developer/Xcode/DerivedData/Runner-boibxjwkabvwbvdeeixuokeyedtq/Build/Intermediates.noindex/ArchiveIntermediates/Runner/BuildProductsPath/Release-iphoneos/Runner.app/Frameworks

Symlinked...

rsync --delete -av --filter P .*.?????? --links --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "../../../IntermediateBuildFilesPath/UninstalledProducts/iphoneos/flutter_native_contact_picker.framework" "/Users/douchuanwei/Library/Developer/Xcode/DerivedData/Runner-boibxjwkabvwbvdeeixuokeyedtq/Build/Intermediates.noindex/ArchiveIntermediates/Runner/InstallationBuildProductsLocation/Applications/Runner.app/Frameworks"

building file list ... rsync: link_stat "/Users/douchuanwei/Desktop/shenlanai/shenlan-app/aiprestamo/ios/../../../IntermediateBuildFilesPath/UninstalledProducts/iphoneos/flutter_native_contact_picker.framework" failed: No such file or directory (2)

done

sent 29 bytes received 20 bytes 98.00 bytes/sec

total size is 0 speedup is 0.00

rsync error: some files could not be transferred (code 23) at /AppleInternal/Library/BuildRoots/9e200cfa-7d96-11ed-886f-a23c4f261b56/Library/Caches/com.apple.xbs/Sources/rsync/rsync/main.c(996) [sender=2.6.9]

Command PhaseScriptExecution failed with a nonzero exit code

【解决方法】
在图中文件圈圈处加上“-f”


4f721aa96cb44c0c3332678c7e015391.jpg

你可能感兴趣的:(iOS开发小问题集合)