2014-11-06 73 views

回答

2

我得到的東西在斯威夫特工作。
我不需要導入任何東西。

是否遵循從https://developers.google.com/cast/docs/ios_sender

的說明,還配置Objective-C的橋接報頭。
https://developer.apple.com/library/ios/documentation/swift/conceptual/BuildingCocoaApps/MixandMatch.html

我把文件GoogleCast.h這裏的位置

enter image description here

我測試此示例代碼:

class ViewController: UIViewController, GCKDeviceScannerListener { 

    var scanner = GCKDeviceScanner()!; 


    func deviceDidComeOnline(device: GCKDevice!) { 
     println("device found - \(device.friendlyName)"); 
    } 


    override func viewDidLoad() { 
     super.viewDidLoad() 
     // Do any additional setup after loading the view, typically from a nib. 

     //scanner = GCKDeviceScanner(); 


     println(scanner) 
     scanner.addListener(self) 

     scanner.startScan() 
    } 
} 

我從Xcode的一個iPhone 5S運行此,它發現我ChromeCast設備:

device found - AW

0

這裏是我如何做它在我的雨燕項目工作(以下谷歌演員指南適用於iOS):

  • 我已經下載Google Cast iOS Sender SDK和我粘貼它在我的項目的根文件夾
  • 我已經內設置其它鏈接器標記構建設置到:-ObjC -lc++
  • 我已經添加了如下框架庫(鏈接,不嵌入):

    1. Accelerate.framework
    2. AudioToolbox.framework
    3. AVFoundation.framework
    4. CoreBluetooth.framework
    5. CoreGraphics.framework
    6. CoreText.framework
    7. Foundation.framework
    8. MediaAccessibility.framework
    9. MediaPlayer.framework
    10. MediaToolbox.framework
    11. QuartzCore.framework
    12. SystemConfiguration.framework
    13. UIKit.framework
  • 不過下我加GoogleCast.framework 鏈接框架庫點擊+ - >添加其他... - > GoogleCast。框架

  • 我已經在「目標的構建階段」中添加了「複製包資源」部分中的新條目。我選擇添加其他GoogleCast.framework - >資源 - > GoogleCastResources.bundle

我還沒有添加任何Objective-C橋接頭,它的工作很棒!

相關問題