iosrubytoday-extensionxcodeproj

Xcodeproj create Today Extension (widget) scheme


Here is the code to create a target scheme.

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

How to create a scheme for Today Extension?

There are some differences: Today Extension scheme locates in xcuserdata instead of xcshareddata and Executable should be Ask on Launch.


Solution

  • Ok, I did it like this:

    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)