当我尝试使用 Xcodeproj 时,我发现了一个可能来自滥用 API 的错误。你能指出我做错了什么吗?
require 'xcodeproj'
project = Xcodeproj::Project.new("test.xcodeproj")
new_target_name = 'test'
project.new_target(:framework, new_target_name, :ios)
project.save
target_to_remove = project.targets.select {|t| t.name == new_target_name}.first
project.targets.delete(target_to_remove)
project.save
target_to_remove.remove_from_project
这个片段给了我以下错误信息。
/usr/local/lib/ruby/gems/2.4.0/gems/xcodeproj-1.4.4/lib/xcodeproj/project/object/configuration_list.rb:101:in `ascii_plist_annotation': undefined method `isa' for nil:NilClass (NoMethodError)
from /usr/local/lib/ruby/gems/2.4.0/gems/xcodeproj-1.4.4/lib/xcodeproj/project.rb:286:in `block in to_ascii_plist'
from /usr/local/lib/ruby/gems/2.4.0/gems/xcodeproj-1.4.4/lib/xcodeproj/project.rb:285:in `each'
from /usr/local/lib/ruby/gems/2.4.0/gems/xcodeproj-1.4.4/lib/xcodeproj/project.rb:285:in `to_ascii_plist'
from /usr/local/lib/ruby/gems/2.4.0/gems/xcodeproj-1.4.4/lib/xcodeproj/project.rb:353:in `block in save'
from /usr/local/lib/ruby/gems/2.4.0/gems/xcodeproj-1.4.4/lib/xcodeproj/project.rb:353:in `open'
from /usr/local/lib/ruby/gems/2.4.0/gems/xcodeproj-1.4.4/lib/xcodeproj/project.rb:353:in `save'
from /Users/testuser/Desktop/XcodeprojTest/test.rb:10:in `<top (required)>'
from -e:1:in `load'
from -e:1:in `<main>'
有任何想法吗?