Xcodeproj 创建 Today Extension (widget) 方案

Xcodeproj create Today Extension (widget) scheme

这是创建目标方案的代码。

scheme = Xcodeproj::XCScheme.new
scheme.add_build_target(target)
scheme.set_launch_target(target)
scheme.save_as(xcode_proj_dir, name)

如何为 Today Extension 创建方案?

有一些差异:今天扩展方案位于 xcuserdata 而不是 xcshareddata 并且 Executable 应该是 Ask on Launch

好的,我是这样做的:

scheme = Xcodeproj::XCScheme.new
scheme.add_build_target(target)
scheme.build_action.add_entry(Xcodeproj::XCScheme::BuildAction::Entry.new(app_target))
scheme.test_action.add_macro_expansion(Xcodeproj::XCScheme::MacroExpansion.new(target))
scheme.launch_action.launch_automatically_substyle = "2"
scheme.profile_action.buildable_product_runnable = Xcodeproj::XCScheme::BuildableProductRunnable.new(app_target, 0)
scheme.save_as(xcode_proj_dir, widget_name)