mPaaS Extension 打开 iOS 项目失败

错误描述

通过 mPaaS Extension 打开 iOS 项目失败,报错如下:

错误码:1
错误描述:undefined method `display_name' for nil:NilClass [Errno 1] (NoMethodError)

解决方法

  1. 根据提示,在 问题报告 弹框中点击 诊断,生成诊断日志。

  2. 打开诊断日志 mpaas.log,查看出错时脚本执行的调用栈。例如下方调用栈表明在执行 search_from_build_phase 阶段遭遇到一个空值。

    [2020-02-03 12:34:12 +0800][mpaas][INFO](version.rb 63): 
    [2020-02-03 12:34:30 +0800][mpaas][ERROR](entry.rb 37): undefined method `display_name' for nil:NilClass
    [2020-02-03 12:34:30 +0800][mpaas][ERROR](entry.rb 44): [!] undefined method `display_name' for nil:NilClass [Errno 1] (NoMethodError)
    [2020-02-03 12:34:30 +0800][mpaas][ERROR](entry.rb 44): 
     /Applications/mPaaSPlugin.app/Contents/Resources/bundle/lib/ruby/gems/2.4.0/gems/mpaas-common-1.1.38/lib/mpaas-common/xcode_helper/build_phase.rb:39:in `block (2 levels) in search_from_build_phase'
     /Applications/mPaaSPlugin.app/Contents/Resources/bundle/lib/ruby/gems/2.4.0/gems/mpaas-common-1.1.38/lib/mpaas-common/xcode_helper/build_phase.rb:39:in `each'
     /Applications/mPaaSPlugin.app/Contents/Resources/bundle/lib/ruby/gems/2.4.0/gems/mpaas-common-1.1.38/lib/mpaas-common/xcode_helper/build_phase.rb:39:in `find'
     /Applications/mPaaSPlugin.app/Contents/Resources/bundle/lib/ruby/gems/2.4.0/gems/mpaas-common-1.1.38/lib/mpaas-common/xcode_helper/build_phase.rb:39:in `block in search_from_build_phase'
     /Applications/mPaaSPlugin.app/Contents/Resources/bundle/lib/ruby/gems/2.4.0/gems/mpaas-common-1.1.38/lib/mpaas-common/xcode_helper.rb:195:in `project_read'
     /Applications/mPaaSPlugin.app/Contents/Resources/bundle/lib/ruby/gems/2.4.0/gems/mpaas-common-1.1.38/lib/mpaas-common/xcode_helper/build_phase.rb:37:in `search_from_build_phase'
     /Applications/mPaaSPlugin.app/Contents/Resources/bundle/lib/ruby/gems/2.4.0/gems/mpaas-project-1.1.16/lib/mpaas-project/project.rb:123:in `block in parse_using_mobile_framework'
     /Applications/mPaaSPlugin.app/Contents/Resources/bundle/lib/ruby/gems/2.4.0/gems/mpaas-project-1.1.16/lib/mpaas-project/project.rb:119:in `each'
     /Applications/mPaaSPlugin.app/Contents/Resources/bundle/lib/ruby/gems/2.4.0/gems/mpaas-project-1.1.16/lib/mpaas-project/project.rb:119:in `parse_using_mobile_framework'
     /Applications/mPaaSPlugin.app/Contents/Resources/bundle/lib/ruby/gems/2.4.0/gems/mpaas-project-1.1.16/lib/mpaas-project/project.rb:84:in `parse_mpaas_targets='
     /Applications/mPaaSPlugin.app/Contents/Resources/bundle/lib/ruby/gems/2.4.0/gems/mpaas-core-1.2.27/lib/mpaas-core/resolver.rb:23:in `initialize'
     /Applications/mPaaSPlugin.app/Contents/Resources/bundle/lib/ruby/gems/2.4.0/gems/mpaas-5.0.8/lib/mpaas/command/project/target.rb:47:in `new'
     /Applications/mPaaSPlugin.app/Contents/Resources/bundle/lib/ruby/gems/2.4.0/gems/mpaas-5.0.8/lib/mpaas/command/project/target.rb:47:in `block in project_structure'
     /Applications/mPaaSPlugin.app/Contents/Resources/bundle/lib/ruby/gems/2.4.0/gems/mpaas-common-1.1.38/lib/mpaas-common/xcode_helper.rb:158:in `block in parse_project_structure'
     /Applications/mPaaSPlugin.app/Contents/Resources/bundle/lib/ruby/gems/2.4.0/gems/mpaas-common-1.1.38/lib/mpaas-common/xcode_helper.rb:156:in `map'
     /Applications/mPaaSPlugin.app/Contents/Resources/bundle/lib/ruby/gems/2.4.0/gems/mpaas-common-1.1.38/lib/mpaas-common/xcode_helper.rb:156:in `parse_project_structure'
     /Applications/mPaaSPlugin.app/Contents/Resources/bundle/lib/ruby/gems/2.4.0/gems/mpaas-5.0.8/lib/mpaas/command/project/target.rb:43:in `project_structure'
     /Applications/mPaaSPlugin.app/Contents/Resources/bundle/lib/ruby/gems/2.4.0/gems/mpaas-5.0.8/lib/mpaas/command/project/target.rb:33:in `run'
     /Applications/mPaaSPlugin.app/Contents/Resources/bundle/lib/ruby/gems/2.4.0/gems/mpaas-5.0.8/lib/mpaas/command.rb:127:in `block in run'
     /Applications/mPaaSPlugin.app/Contents/Resources/bundle/lib/ruby/gems/2.4.0/gems/mpaas-5.0.8/lib/mpaas/command.rb:91:in `assert'
     /Applications/mPaaSPlugin.app/Contents/Resources/bundle/lib/ruby/gems/2.4.0/gems/mpaas-5.0.8/lib/mpaas/command.rb:127:in `run'
     /Applications/mPaaSPlugin.app/Contents/Resources/bundle/lib/ruby/gems/2.4.0/gems/mpaas-5.0.8/lib/mpaas/command.rb:127:in `block in run'
     /Applications/mPaaSPlugin.app/Contents/Resources/bundle/lib/ruby/gems/2.4.0/gems/mpaas-5.0.8/lib/mpaas/command.rb:91:in `assert'
     /Applications/mPaaSPlugin.app/Contents/Resources/bundle/lib/ruby/gems/2.4.0/gems/mpaas-5.0.8/lib/mpaas/command.rb:127:in `run'
     /Applications/mPaaSPlugin.app/Contents/Resources/bundle/lib/ruby/gems/2.4.0/gems/mpaas-5.0.8/lib/mpaas/entry.rb:19:in `start'
     /Applications/mPaaSPlugin.app/Contents/Resources/bundle/lib/ruby/gems/2.4.0/gems/mpaas-5.0.8/bin/mpaas:11:in `<top (required)>'
     /Applications/mPaaSPlugin.app/Contents/Resources/bundle/bin/mpaas:23:in `load'
     /Applications/mPaaSPlugin.app/Contents/Resources/bundle/bin/mpaas:23:in `<main>'
    [2020-02-03 12:35:04 +0800][mpaas][DEBUG](command.rb 166): 当前执行命令: diagnose report -o /Users/donglei/Library/Logs/com.mpaas.MPaaSIDEPlugin --verbose
    [2020-02-03 12:35:04 +0800][mpaas][DEBUG](command.rb 167): ------------------------------
    [2020-02-03 12:35:04 +0800][mpaas][INFO](ui_logger.rb 141): >>> 检查环境
    [2020-02-03 12:35:04 +0800][mpaas][INFO](report.rb 32): -- General --
  3. 通过 Xcode 打开原有项目,查看 Build Phase 中的设置,例如本例中存在空引用: build phase

  4. 删除空引用后,即可重新通过 mPaaS Extension 打开项目。