2017-02-21 105 views
0

我正在嘗試使用CocoaPods將JWPlayer SDK添加到我的新Swift項目中。如何使用可可豆莢和swift導入框架3

我創建了一個新項目。下面添加到Podfile

use_frameworks! 
target 'JWPlayerTutorial' do 
pod 'JWPlayer-SDK', '~> 2.0' 
end 

我再添加一個import語句以一個視圖控制器:

import Pods_JWPlayerTutorial 

import JWPlayer_SDK 

當我嘗試var player: JWPlayer我得到的錯誤:

Use of undeclared type JWPlayer 

我應該添加橋接頭嗎?我應該添加框架來構建階段嗎?我需要更改鏈接器標誌設置嗎?什麼是正確的進口聲明使用?

這裏是我的項目結構的屏幕截圖: enter image description here

+0

因爲JWPlayer都是客觀的 - C,你需要一個橋頭。 – Sneha

回答

1

請訪問https://developer.jwplayer.com/sdk/ios/docs/developer-guide/intro/getting-started/用於補充JWPlayer SDK在斯威夫特的步驟。

+0

我跟着那個。我添加了一個podfile的框架,更新了info.plist。我使用了use_frameworks!在podfile中,所以我不需要使用import語句。我也沒有更改鏈接器標籤,因爲pod安裝似乎爲我改變了它。我錯過了什麼? – grabury

+0

Clean Xcode項目。清除派生數據。關閉Xcode並重新啓動設備/模擬器。也許它應該工作。 – Sneha

相關問題