OC項(xiàng)目中用Cocoapods集成Swift庫(kù)--問(wèn)題匯總

雖然目前 Swift 項(xiàng)目開(kāi)發(fā)比較流行,但是在以前就項(xiàng)目中還是使用 OC 完成開(kāi)發(fā)。

項(xiàng)目重構(gòu)又比較耗費(fèi)時(shí)間,因此在 OC 項(xiàng)目中用 Cocoapods 集成 Swift 庫(kù)是比較常用的方法。

下面是使用此方法遇到的問(wèn)題解決,特此總結(jié)。

  1. 使用 pod 安裝一個(gè) swift 庫(kù),pod install 報(bào)錯(cuò):
[!] Unable to determine Swift version for the following pods:

- `AWSMobileClient` does not specify a Swift version and none of the targets (`ESPMeshLibrary`) integrating it have the `SWIFT_VERSION` attribute set. Please contact the author or set the `SWIFT_VERSION` attribute in at least one of the targets that integrate this pod.

解決方法:

需要在每個(gè) target 中設(shè)置swift 版本,搜索SWIFT_VERSION,如果沒(méi)有,需要手動(dòng)添加一個(gè)

屏幕快照 2019-11-18 上午11.23.06.png
[!] The following Swift pods cannot yet be integrated as static libraries:

The Swift pod `AWSMobileClient` depends upon `AWSAuthCore` and `AWSCognitoIdentityProvider`, which do not define modules. To opt into those targets generating module maps (which is necessary to import them from Swift when building as static libraries), you may set `use_modular_headers!` globally in your Podfile, or specify `:modular_headers => true` for particular dependencies.

解決方法:

在podfile中寫上use_frameworks!

source 'https://github.com/CocoaPods/Specs.git'

platform :ios, '9.0'
target :'ESPAWSOCDemo' do
    use_frameworks!

    pod 'AWSCore', '~> 2.9.0'
    #pod 'AWSAppSync', '~> 2.10.0'

    pod 'AWSMobileClient', '~> 2.9.0'      # Required dependency
    pod 'AWSAuthUI', '~> 2.9.0'            # Optional dependency required to use drop-in UI
    pod 'AWSUserPoolsSignIn', '~> 2.9.0'   # Optional dependency required to use drop-in UI

    pod 'AWSIoT', '~> 2.9.0'

end
最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書(shū)系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容