今天在object-c 和swift 混編的時(shí)候出現(xiàn)錯(cuò)誤:could not build module foundation
當(dāng)我把oc代碼導(dǎo)入swift工程時(shí)候沒(méi)有出來(lái)智嚷,編譯是正常的,當(dāng)我建立pch文件引用時(shí)候就出現(xiàn)could not build module foundation
這個(gè)問(wèn)題折騰了好久,在網(wǎng)上找到解決辦法仇祭,我把這個(gè)問(wèn)題記錄下仁讨,希望能幫到有需要的人
解決方法:
在pch 找到需要引用的的頭文件前面加上#ifdef OBJC 要導(dǎo)入的頭文件 #endif
如下圖:
image.png
https://stackoverflow.com/questions/19723392/adding-c-file-causes-pch-error