我尝试使用cocoapods-packager从podspec生成框架:
pod package MyCore.podspec --embedded --subspecs=SDK
在Xcode 11中,一切都很好,但是在Xcode 12上,我得到跟随错误:
严重错误: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/lipo: Pods / build / package.a和Pods / build-sim / package.a具有相同的功能 架构(arm64),并且不能位于同一胖输出文件中
此处建议的解决方案:Xcode 12, building for iOS Simulator, but linking in object file built for iOS, for architecture arm64添加:
s.pod_target_xcconfig = { 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'arm64' }
s.user_target_xcconfig = { 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'arm64' }
对我不起作用。这与我使用依赖项有关吗?有人知道如何解决此问题吗?
Podspec:
#
# Be sure to run `pod lib lint **.podspec' to ensure this is a
# valid spec and remove all comments before submitting the spec.
#
# Any lines starting with a # are optional, but encouraged
#
# To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html
#
Pod::Spec.new do |s|
s.name = "MyCore"
s.version = "9.1.1.2360"
s.summary = "A short description of ***."
s.homepage = "https://github.com/***/***"
s.license = 'Private'
s.author = { "***" }
s.source = { :git => "***", :tag => s.version.to_s }
s.platform = :ios, '10.0'
s.requires_arc = true
s.module_name = '***'
s.default_subspec = 'Core'
s.static_framework = true
s.pod_target_xcconfig = { 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'arm64' }
s.user_target_xcconfig = { 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'arm64' }
s.subspec 'Core' do |ss|
ss.source_files = 'Pod/Classes/**/*.{h,m,c}'
ss.resources = ['Pod/CoreData/DrivePal.{xcdatamodeld,xcmappingmodel}', 'Pod/CoreData/mapping_*.xcmappingmodel', 'Pod/Assets/**/*.{csv,storyboard}']
ss.resource_bundle = {
'**Core_CoreData' => ['Pod/CoreData/DrivePal.{xcdatamodeld,xcmappingmodel}', 'Pod/CoreData/mapping_*.xcmappingmodel','Pod/Assets/**/crash*.txt'],
}
ss.preserve_paths = ['Pod/CoreData/*.xcdatamodeld', 'Pod/CoreData/*.xcmappingmodel']
ss.frameworks = 'CoreLocation', 'CoreBluetooth', 'CoreMotion', 'CoreData', 'AVFoundation', 'SystemConfiguration', 'Foundation'
ss.library = 'z'
ss.dependency 'CocoaLumberjack', '~> 3.5.3'
ss.dependency 'Mantle', '2.1.4'
ss.dependency 'MTLManagedObjectAdapter', '~> 1.0.3'
ss.dependency 'AFNetworking/Serialization', '~> 3.2.1'
ss.dependency 'AFNetworking/Reachability', '~> 3.2.1'
ss.dependency 'AFNetworking/NSURLSession', '~> 3.2.1'
ss.test_spec '***CoreTests' do |core_tests|
core_tests.source_files = 'Pod/***CoreTests/**/*.{h,m}'
core_tests.resources = 'Pod/***CoreTests/**/*.{json,txt}'
end
end
# Core is copy of SDK
s.subspec 'SDK' do |sdk|
sdk.source_files = 'Pod/Classes/**/*.{h,m,c}'
sdk.exclude_files = ['Pod/***CoreTests/*']
sdk.resources = ['Pod/CoreData/DrivePal.{xcdatamodeld,xcmappingmodel}', 'Pod/CoreData/mapping_*.xcmappingmodel']
sdk.resource_bundle = {
'***Core_CoreData' => ['Pod/CoreData/DrivePal.{xcdatamodeld,xcmappingmodel}','Pod/CoreData/mapping_*.xcmappingmodel','Pod/Assets/**/crash*.txt'],
}
sdk.compiler_flags = '-DTESTING=0'
sdk.preserve_paths = ['Pod/CoreData/*.xcdatamodeld', 'Pod/CoreData/*.xcmappingmodel']
sdk.frameworks = 'CoreLocation', 'CoreBluetooth', 'CoreMotion', 'CoreData', 'AVFoundation', 'SystemConfiguration', 'Foundation'
sdk.library = 'z'
sdk.dependency 'CocoaLumberjack', '~> 3.5.3'
sdk.dependency 'Mantle', '2.1.4'
sdk.dependency 'MTLManagedObjectAdapter', '~> 1.0.3'
sdk.dependency 'AFNetworking/Serialization', '~> 3.2.1'
sdk.dependency 'AFNetworking/Reachability', '~> 3.2.1'
sdk.dependency 'AFNetworking/NSURLSession', '~> 3.2.1'
sdk.pod_target_xcconfig = { 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'arm64', 'ONLY_ACTIVE_ARCH' => 'YES' }
sdk.user_target_xcconfig = { 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'arm64','ONLY_ACTIVE_ARCH' => 'YES' }
sdk.public_header_files = [****]
end
end
更新:
如果我添加--exclude-deps
标志,它可以工作,但是我的框架不包含依赖项。
答案 0 :(得分:0)
通过修改本地cocoapods-packager源ruby代码解决。 修改的.rb文件的路径:
/Library/Ruby/Gems/2.6.0/gems/cocoapods-packager-1.5.0/lib/cocoapods-packager/pod_utils.rb(路径可能与/ Users / USER / .rvm / gems / ruby-2.6.3 / gems / cocoapods-packager-1.5.0 / lib / cocoapods-packager / pod_utils.rb)
unless static_installer.nil?
static_installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['CLANG_MODULES_AUTOLINK'] = 'NO'
config.build_settings['GCC_GENERATE_DEBUGGING_SYMBOLS'] = 'NO'
config.build_settings['EXCLUDED_ARCHS[sdk=iphonesimulator*]'] = 'arm64' // <-- inserted here
end
end
static_installer.pods_project.save
end