Ruby 在pod文件中以编程方式将静态库添加到pod目标(链接的框架和库)
我想自动将静态库文件(.a)添加到xoce中的目标 此过程很容易手动完成: 我认为最好的方法是在pod文件中 但我不知道如何处理细节Ruby 在pod文件中以编程方式将静态库添加到pod目标(链接的框架和库),ruby,xcode,cocoapods,Ruby,Xcode,Cocoapods,我想自动将静态库文件(.a)添加到xoce中的目标 此过程很容易手动完成: 我认为最好的方法是在pod文件中 但我不知道如何处理细节 post|u install do|installer| installer.pods_project.targets.each do| target| 如果target.name=='Pods EVORecording EVORecording Movesense' #我想这里可能是添加.a文件的代码 结束 结束 结束 这将是创建一些提示来解决这项任务。非常
post|u install do|installer|
installer.pods_project.targets.each do| target|
如果target.name=='Pods EVORecording EVORecording Movesense'
#我想这里可能是添加.a文件的代码
结束
结束
结束
这将是创建一些提示来解决这项任务。非常感谢。我自己解决了这个问题。以下是解决方案:
post_install do |installer|
lib_name = "libmds.a"
lib_path = "Movesense/IOS/Movesense/Release-iphoneos"
# get ref of lib file
path = File.dirname(__FILE__) + "/Pods/" + lib_path + "/" + lib_name
movesense_ref = installer.pods_project.reference_for_path(path)
installer.pods_project.targets.each do |target|
# find the right target
if target.name == 'EVORecording-iOS'
# add libmds.a file to build files
build_phase = target.frameworks_build_phase
build_phase.add_file_reference(movesense_ref)
target.build_configurations.each do |config|
# add library search paths
config.build_settings['LIBRARY_SEARCH_PATHS'] = ["$(inherited)", "$(PROJECT_DIR)/" + lib_path]
end
end
end
end