XcodeGen - 如何配置通知服务扩展目标?

问题描述 投票:0回答:1

也许有人已经解决了这个问题。如果你知道请告诉我。如何使用 XcdoeGen 添加通知服务扩展目标? 我只是在 XcodeGen 中没有看到这种类型的目标。也许根本不支持。也许有一些解决方法,如果有人已经使用 XcodeGen 完成了此操作,请提供帮助。

push-notification notifications apple-push-notifications xcodegen
1个回答
0
投票

目标类型是

app-extension
,这就是它在我的project.yml 文件中的样子

NotificationService:
    platform: iOS
    type: app-extension
    sources:
      - NotificationService
    dependencies:
       - package: my_package_dependency1
       - package: my_package_dependency2
    settings:
      base:
        ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES: ${inherited}
        PRODUCT_NAME: NotificationService
        PRODUCT_MODULE_NAME: NotificationService
        DEVELOPMENT_TEAM: YOU_TEAM
        CODE_SIGN_STYLE: Manual
        TARGETED_DEVICE_FAMILY: "1,2"
      configs:
        Debug:
          PRODUCT_BUNDLE_IDENTIFIER: 'com.myAppBundleID.debug.NotificationService'
        Beta:
          PRODUCT_BUNDLE_IDENTIFIER: 'com.myAppBundleID.beta.NotificationService'
        Release:
          PRODUCT_BUNDLE_IDENTIFIER: 'com.myAppBundleID.NotificationService'
    configFiles:
      Debug: debugNotification.xcconfig
      Beta: betaNotification.xcconfig
      Release: releaseNotification.xcconfig
    info:
      path: NotificationService/NotificationInfo.plist
      properties:
        NSExtension:
          NSExtensionPointIdentifier: 'com.apple.usernotifications.service'
          NSExtensionPrincipalClass: '$(PRODUCT_MODULE_NAME).NotificationService'
        CFBundleName: NotificationService
        CFBundleDisplayName: your_bundle_display_name
        CFBundleShortVersionString: 1.0.0
        CFBundlePackageType: $(PRODUCT_BUNDLE_PACKAGE_TYPE)
然后,在主目标的依赖项中,添加:

dependencies:
       - package: my_package_dependeny
       - target: NotificationService
         embed: true

如果您想调试,还可以为其创建一个简单的方案:

schemes:
  NotificationService:
    build:
      targets:
        NotificationService: all
        [MainTargetName]: all
      parallelizeBuild: true
      buildImplicitDependencies: true
    run:
      config: Debug
    test:
      config: Debug
    profile:
      config: Release
    analyze:
      config: Debug
    archive:
      config: Release

希望有帮助!

© www.soinside.com 2019 - 2024. All rights reserved.