yonaskolb / XcodeGen

A Swift command line tool for generating your Xcode project
MIT License
7.01k stars 819 forks source link

Siri Shortcuts - Intents Extension and Intents Extension UI #623

Open kmentrobin opened 5 years ago

kmentrobin commented 5 years ago

Hi, I have problem with adding Instents Extension to support Siri shortcuts.

This is my project.yml file

name: TestIntents
targets:
  TestIntents:
    type: application
    platform: iOS
    deploymentTarget: 12.0
  IntentExtension:
    type: app-extension.intents-service
    platform: iOS
    deploymentTarget: 12.0
    sources:
      - path: IntentExtension/
    settings:
      base:
          INFOPLIST_FILE: IntentExtension/Info.plist

When I run it I see IntentExtension but without Info.plist

yonaskolb commented 5 years ago

Hi @kmentrobin. Does an Info.plist file actually exist at the path? If you create the target through Xcode it will give you an Info.plist you can use. XcodeGen doesn't generate these by default (You can do this with target.info but it only has some basic settings to start with and you may need more the Xcode new target template can give you) https://github.com/yonaskolb/XcodeGen/blob/master/Docs/ProjectSpec.md#target

chc24 commented 4 years ago

@yonaskolb I believe this might be happening to me as well. I've been able to use XcodeGen to create a today extension, but when I create another target with app-extension.intents-service, the info-plist fails to generate and the extension is not recognized as an intents extension. Here is what my target looks like, and i've embedded this into the container app as follows:

targets:
  ExtensionIntents:
    type: app-extension.intents-service
    deploymentTarget: 11.0
    platform: iOS
    templates:
      - ExtensionIntentsTemplate
    settings:
      base:
        PRODUCT_BUNDLE_IDENTIFIER: co.project.Intents
        INFOPLIST_FILE: Info/Extensions/ExtensionIntentsInfo.plist
    sources:
      - path: Intents

Main App:

MainApp:
  [...]
  dependencies:
      - target: IntentsExtension
         embed: true
        codeSign: false
        buildPhase:
          copyFiles:
            destination: plugins

And yes, an info.plist does exist at that path. When I create the intents target manually through xcode, everything looks good, but for my use case this extension needs to be regenerated every time.

amine2233 commented 4 years ago

Hello @chc24, do you have an example to use XcodeGen to create a today extension ? Thanks

ualch9 commented 4 years ago

Xcode does not recognize app-extension.intents-service. Use app-extension instead. Details: https://github.com/OneBusAway/OBAKit/pull/252#issuecomment-660808063

imWildCat commented 2 years ago

@ualch9 what's the first version of Xcode which does not recognize app-extension.intents-service? Should we update the doc of Xcodegen?

ualch9 commented 2 years ago

@imWildCat

what's the first version of Xcode which does not recognize app-extension.intents-service?

Considering I worked on this two years ago, two majors ago, I would say probably Xcode 11. Sorry, I don't remember much from this work.

Should we update the doc of Xcodegen?

I do not know if this has been fixed by Apple, but if my comment is still true today (in Xcode 13), seeing how intents-service is a subdomain of app-extension, I would say that the docs should include a note that although all other extensions have a subdomain (i.e. messages or messages-sticker-pack), intents doesn't have one.