YouTube-Player-iOS-Helper无法使用YTPlayerView类 [英] YouTube-Player-iOS-Helper can't use YTPlayerView class

查看:699
本文介绍了YouTube-Player-iOS-Helper无法使用YTPlayerView类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试实现youtube-ios-player-helper,可在此处找到:中所述。


I am trying to implement the youtube-ios-player-helper, found here: https://github.com/youtube/youtube-ios-player-helper

What I did: Edited my podfile, pod update, everything fine without any errors, Alamofire - which was also added via cocoapods still working

I can see the Pod in my workspace, and I can even select YTPlayerView as Class for my UIView in Storyboard

But when it comes to adding the IBOutlet it doesn't recognize the YTPlayerView Class anymore?!

Shouldn't it be impossible to even select it in storyboard if the Pod wasnt properly added?

I also tried the "manual" method, that gave a slightly better result as it would let me define the Player, but wouldn't let me import the YTPlayerView via Bridging-Header

解决方案

The YTPlayerView is in the separate Pods module which you need to import.

My Podfile:

platform :ios, '8.3'

target 'MyApp' do
    use_frameworks!
    pod 'youtube-ios-player-helper'
end

Your Swift file:

import UIKit
import youtube_ios_player_helper // You're missing this line

class MyView: UIView { // Some class

    @IBOutlet var playerView: YTPlayerView!

    // ...

}

If import youtube_ios_player_helper doesn't work for you, you can add #import "YTPlayerView.h" to your bridging header as stated in Fayza Nawaz's answer.

这篇关于YouTube-Player-iOS-Helper无法使用YTPlayerView类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆