首页 > 解决方案 > 支持模拟器与 iOS 设备的不同供应商框架

问题描述

我正在尝试编写一个 PodSpec,它允许我们JellyFrameworkForDefice.framework在安装到设备时使用一个框架,JellyFrameworkForSimulator.framework在通过 Xcode 安装到模拟器时使用另一个框架。有没有人对此有任何想法或有他们以前见过的例子?

Pod::Spec.new do |s|
  s.name             = 'Jelly'
  s.module_name      = 'Jelly'
  s.version          = '1.0.3'
  s.summary          = 'Jelly 4.1.2'
  s.description      = <<-DESC
     TODO: Add long description of the pod here.
                   DESC
  s.homepage         = 'https://github.com/<GITHUB_USERNAME>/Jelly'
  s.license          = { :type => 'MIT', :file => 'LICENSE' }
  s.author           = { '' => '' }
  s.source           = { :git => 'https://github.com/<GITHUB_USERNAME>/Jelly', :tag => s.version.to_s }
  s.ios.deployment_target = '8.0'
  s.source_files = 'Jelly/Classes/**/*.h', 'Jelly/Classes/**/*.m',  'Jelly/Classes/**/*.mm'
  s.resources = 'Jelly/Assets/UX_Resources/*', 'Jelly/Classes/UX/Resources/*'
  s.libraries        = 'c++'
  s.vendored_framework = 'Jelly/Libraries/JellyFrameworkForDefice.framework', 'Jelly/Libraries/JellyFrameworkForSimulator.framework'
  s.dependency 'Cordova', '4.2.1'
  s.dependency 'DependencyContainer'
  s.dependency 'JellyService'
  s.compiler_flags = '-lstdc++', '-lc++'
  s.ios.framework  = 'AudioToolbox', 'AVFoundation', 'CoreGraphics', 
          'CoreMedia', 'CoreVideo', 'MobileCoreServices', 'OpenGLES', 
          'QuartzCore', 'Security', 'ImageIO', 'Foundation', 'UIKit'
  s.xcconfig = { 'OTHER_LDFLAGS[sdk=iphonesimulator*]' => '$(inherited) -framework "JellyFrameworkForSimulator"',
'OTHER_LDFLAGS[sdk=iphoneos*]' => '$(inherited) -framework "JellyFrameworkForDefice"' }
end

标签: cocoapodspodspec

解决方案


推荐阅读