ios - 如何通过 use_frameworks 使用 YouTube iOS 播放器助手!使用 CocoaPods

标签 ios swift youtube cocoapods ytplayerview

<分区>

正如问题所述,我正在尝试使用 Podfile 上的 use_frameworks! 选项在我的 Swift 项目中使用此模块。像这样:

platform :ios, "8.0"
source 'https://github.com/CocoaPods/Specs.git'

use_frameworks!

pod 'youtube-ios-player-helper', '~> 0.1.3'
pod 'ReactiveCocoa', '3.0-beta.6'
pod 'Moya'
pod 'Moya/Reactive'

我检查了 Pods 项目,它有一个名为 youtube_ios_player_helper.framework 的框架,因为 - 是名称的无效字符。但是当我将 import youtube_ios_player_helper 添加到我的 Swift 文件时,我收到一条错误消息,指出它不存在。

我必须说我的项目中有一些 Obj-C 代码,因此我在项目中也有一个桥接头文件。

最佳答案

确保您将库添加到正确的目标。

我的播客文件:

platform :ios, '8.3'

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

ViewController.swift:

import UIKit
import youtube_ios_player_helper

class ViewController: UIViewController {

    // ...

    override func viewDidLoad() {
        super.viewDidLoad()

        let myView = YTPlayerView()

        // ...
    }

    // ...

}

如果纯 swift import import youtube_ios_player_helper 不起作用,将 #import "YTPlayerView.h" 添加到您的应用程序的桥接 header 应该与桥接Swift 的 YouTube 帮助类。

关于ios - 如何通过 use_frameworks 使用 YouTube iOS 播放器助手!使用 CocoaPods,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30647518/

相关文章:

ios - iPhone - 有没有办法在设备级别调整屏幕亮度

swift - Monty Hall 模拟仅 44%

ios - 键盘下的文本字段

codeigniter - youtube:合并一系列视频文件并上传为单个视频

javascript - 尝试在我流行的帖子小部件中将 Youtube 缩略图从 default.jpg 调整为 0.jpg (我将 imgs 调整为 300px)

javascript - 无法根据设备自动调整YouTube播放器的大小

ios - 如何从弹出窗口中显示的 UIViewController 中找到 UIPopoverController?

ios - 在 iOS 中绘制标尺 - 在屏幕上精确 1 厘米 - 如何绘制相距 1 毫米的线?

iOS 应用程序登录到 LinkedIn 并且不显示权限请求

ios - 快速禁用 WKWebview 中的 Youtube 应用程序重定向