1.首先是制作framework階段 需要注意到CPU的架構(gòu)適配
改為NO之后 跑在什么什么機(jī)型上 就是什么機(jī)型的CPU架構(gòu)
2.其次是導(dǎo)出framework時(shí) 改成release模式
這個(gè)錯(cuò)誤的出現(xiàn) 很多人看到可能照著image使勁了 但是和image沒??關(guān)系
首先.a文件 一定是靜態(tài)庫(kù)
.framework文件 有可能是靜態(tài)庫(kù) 也有可能是動(dòng)態(tài)庫(kù)
swift打出來(lái)的framework一定是動(dòng)態(tài)庫(kù)
所以如果你選用的OC的話 可以再導(dǎo)出framework之前 指定你的framework是動(dòng)態(tài)庫(kù) 還是靜態(tài)庫(kù) 指定的方式是:
如果沒指定framework的類型
你把framework導(dǎo)入到工程里了 尤其是Swift的framework
工程并不知道他的類型
所以必須報(bào)image Not Found
解決的方式是:
在這塊再導(dǎo)入一下就好了...
4.這個(gè)Bug對(duì)應(yīng)題目 令人惡心 什么玩意!!!
<pre>
當(dāng)我新創(chuàng)建一個(gè)工程的時(shí)候 把TextToSpeechV.framework導(dǎo)入工程中 在新創(chuàng)建的Swift文件里 import UIKit
import TextToSpeechV1
class LDPerson: NSObject {
}
當(dāng)我Commend+左鍵 點(diǎn)import TextToSpeechV1 是可以點(diǎn)進(jìn)去的
但是當(dāng)我在目前開發(fā)的項(xiàng)目里導(dǎo)入一模一樣的framework 而且所有導(dǎo)入細(xì)節(jié)一致 嘗試了多次 每次Commend+左鍵 點(diǎn)import TextToSpeechV1 都是顯示Couldn't Generate Swift Representation
Error(from SourceKit):
"Could not load module:TextToSpeechV1"贤徒。
</pre>
什么意思呢 就是一點(diǎn)framework的頭文件 就顯示這個(gè)圖了
最終在StandOverFlow上找到了答案:
就是工程所在的文件夾不能有空格 比如我的項(xiàng)目在這個(gè)文件夾下
這個(gè)文件夾的名稱 AI后面有一個(gè)空格 就不行 ! 就點(diǎn)不進(jìn)去framework的頭文件!
以下下是StandOverFlow的完整解釋:
<pre>
From my experience there are two possible causes for this issue. The first one is that your framework can't be located. To fix this you need to go to target's Build Settings and add a path to Framework Search Paths either an absolute:
/Users/{user}/path-to-framework-parent-directory
or relative to project directory:
$(PROJECT_DIR)/path-to-framework-parent-directory
Another possible cause is that the path to your framework contains a space in it. I found that it doesn't matter whether you try to escape it with backslash ../Project\ Name/frameworks or take the whole path in double-quotes "../Project Name/frameworks". The result would be that SourceKit could not load the module.
Note that $(PROJECT_DIR) could expand to a path with a space in it and it would too result in the same error. So it looks like a bug in Xcode/SourceKit (I tried the latest Xcode 7.2-beta3 and the bug is still there).
My repository was on the second hard drive /Voluems/Macintosh HD/Repos. I just renamed the hard drive to HD, so the path looks like /Volumes/HD/Repos and the problem was gone.
</pre>
<pre>
寫的有誤之處 望不吝指教??
</pre>