1

我有一个使用 xcodeproject 的 ruby​​ 代码,它将我的 Google-Info.plist 添加到 Runner.xcodeproj 作为参考。但是我想删除较旧的参考,因为我收到以下错误:

Xcode's output:
↳
    error: Multiple commands produce '/Users/figengungor/Documents/projects/app_gmo/base/build/ios/Release-iphoneos/Runner.app/GoogleService-Info.plist':
    1) Target 'Runner' (project 'Runner') has copy command from '/Users/figengungor/Documents/Base Firebase Files/GoogleService-Info.plist' to
    '/Users/figengungor/Documents/projects/app_gmo/base/build/ios/Release-iphoneos/Runner.app/GoogleService-Info.plist'
    2) Target 'Runner' (project 'Runner') has copy command from '/Users/figengungor/Documents/projects/app_gmo/base/ios/GoogleService-Info.plist' to
    '/Users/figengungor/Documents/projects/app_gmo/base/build/ios/Release-iphoneos/Runner.app/GoogleService-Info.plist'

以下是我添加 Google-Info.plist 参考的方法:

require 'xcodeproj'
project = Xcodeproj::Project.open(ARGV[0])
main_target = project.targets.first
gsi_reference = project.main_group['Runner'].new_file(ARGV[1])
main_target.add_file_references([gsi_reference])
project.save 

这是我试图删除但没有成功的代码(我不熟悉 Ruby,试图遵循文档):

old_gsi_reference = project.main_group['Runner'].find_file_by_path('/Users/figengungor/Documents/Base Firebase Files/GoogleService-Info.plist')
old_gsi_reference.remove_from_project()

有没有人有 xcodeproject 的经验并且可以帮助我?

4

0 回答 0