试图将OpenTok 2.3添加为本地cocoapod

时间:2014-10-01 16:29:56

标签: ios objective-c xcode cocoapods opentok

我需要将OpenTok 2.3添加到使用cocoapods的项目中,但是pods存储库或github上只有2.1.7,所以我在本地下载了框架。我的文件夹结构如下所示:

project-
       |
       Podfile
       project.xcodeproj
       frameworks/
                 |
                 OpenTokSDK-WebRTC.podspec
                 OpenTok-iOS-2.3.0/
                                  |
                                  OpenTok.framework

OpenTokSDK-WebRTC.podspec文件的内容是:

Pod::Spec.new do |s|
s.name = 'OpenTokSDK-WebRTC'
s.version = '2.3'
s.authors = 'TokBox'
s.summary = 'The OpenTok iOS SDK lets you use OpenTok video sessions in apps you build for iPad, iPhone, and iPod touch devices.'
s.homepage = 'https://github.com/opentok/opentok-ios-sdk-webrtc/'
s.license = {
    :type => 'Apache'
}
s.source = {
    :path => './OpenTok-iOS-2.3.0'
}
s.platforms = {
    :ios => '5.0'
}
s.source_files = 'Opentok.framework/Versions/A/Headers/*.h'
s.resources = 'Opentok.framework/Versions/A/Resources/opentok.bundle'
s.frameworks = [
    "Opentok",
    "UIKit",
    "CoreMedia",
    "CoreVideo",
    "CoreAudio",
    "CoreTelephony",
    "CFNetwork",
    "AVFoundation",
    "SystemConfiguration",
    "Security",
    "QuartzCore",
    "AudioToolbox",
    "OpenGLES",
    "MobileCoreServices"
]
s.libraries = [
    "stdc++",
    "z"
]
s.xcconfig = {
    :FRAMEWORK_SEARCH_PATHS => "\"frameworks/OpenTokSDK-WebRTC/\""
}
s.preserve_paths = 'Opentok.framework'
s.requires_arc = false

end

Podfile中的相关行是

pod 'OpenTokSDK-WebRTC', :path => "frameworks"

当我运行“pod install'一切似乎都运行良好,但是在Pods目录中没有OpenTokSDK文件夹,并且在尝试包含时,我在xcode中找不到文件错误。有谁知道我错过了什么? 谢谢你的帮助。

1 个答案:

答案 0 :(得分:0)

正如我在博客中找到的,这是链接new-in-ios-10-the-best-webrtc-apps-yet。您需要在pod文件中添加pod 'OpenTok'。所以在您的项目中添加了更新版本的对话框。现在打开 xcworkspace 文件取代 xcodeproj 文件。

这是我的Podfile,

# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'

target 'ProjectName' do
  # Uncomment the next line if you're using Swift or would like to use dynamic frameworks
  # use_frameworks!
pod 'AFNetworking', '~> 3.0'
pod 'OpenTok'
  # Pods for ProjectName

  target 'ProjectNameTest' do
    inherit! :search_paths
    # Pods for testing
  end

  target 'ProjectNameUITests' do
    inherit! :search_paths
    # Pods for testing
  end

end

注意: - 如果您使用的是Swift,请取消注释#use_frameworks!

更新您的pod文件后,在终端中输入“pod install”命令。和Tokbox将成功安装在您的项目中。enter image description here

enter image description here