[Tracking][Beta] Embedding Apple Watch App inside NativeScript App

未关闭
#4,589 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
5/5
预计耗时
一周以上
新手友好度
25/100
Issue 类型
功能
描述清晰度
需要澄清
活跃度
停滞
技术栈
ios, javascript
领域
cli, mobile-dev

调研方向

这是一个用于跟踪和讨论的 issue;请从链接的 feature issue #4541 开始,并查看使用 App_Resources/iOS/watchapp 和 watchextension 的已记录 Xcode 工作流。payload 没有指出源文件或测试,除了 watch-app 的总体行为和列出的已知问题之外,完成标准未作定义。

由索引模型根据 Issue 内容生成。

描述

os: ios

Overview

Apple Watch App Beta feature enables embedding a watch app in NativeScript application by adding watchapp and watchextension folders inside App_Resources/iOS/.

The watch app should be created and developed inside Xcode. Once the user is happy with the result, the folder containing the watch app and the watch app extension should be copied inside App_Resources/iOS/watchapp and App_Resources/iOS/watchextension respectively. Optionally you can add watchapp.json and extension.json which support multiple configurations for the build of the watch app and watch app extension.
Example JSON file:

{
    "assetcatalogCompilerAppiconName": "AppIcon",
    "targetBuildConfigurationProperties": {
        "WATCHOS_DEPLOYMENT_TARGET": 4.1
    }
}

In the example above you should have an .xcassets catalog with AppIcon.appiconset inside the watchapp folder.

More information can be found in the feature issue here.

Workflow:
  1. Create Single Page App from Xcode.
  2. Add watch app target - File>New>Target>WatchKit App
  3. Add a name to your watch app, for example MyFirstWatchApp
  4. Copy the generated "MyFirstWatchApp" and MyFirstWatchApp Extension to .../apps/MyApp/app/App_Resources/iOS/watchapp/MyFirstWatchApp and .../apps/MyApp/app/App_Resources/iOS/watchextension/MyFirstWatchApp Extension respectively.
  5. Inside the Info.plist of the Watch App replace the value of WKCompanionAppBundleIdentifier with $(WK_APP_BUNDLE_IDENTIFIER).
    6 Inside the Info.plist of the Watch Extension replace the value of WKAppBundleIdentifier with $(WK_APP_BUNDLE_IDENTIFIER).
  6. You can populate the Assets.xcassets of the Watch App and the Watch Extension and add the name of the appiconset to the .../apps/MyApp/app/App_Resources/iOS/watchapp/MyFirstWatchApp/watchapp.json and .../apps/MyApp/app/App_Resources/iOS/watchextension/MyFirstWatchApp Extension/extension.json respectively:
{
    "assetcatalogCompilerAppiconName": "AppIcon"
}
  1. You can modify the WATCHOS_DEPLOYMENT_TARGET of the Watch App by adding the value inside the watchapp.json like this:
{
    "assetcatalogCompilerAppiconName": "AppIcon",
    "targetBuildConfigurationProperties": {
        "WATCHOS_DEPLOYMENT_TARGET": 4.1
    }
}
  1. Run the NativeScript application
Known issues
  • The watch app inside NativeScript application support only Automatic code signing. Any provision configuration inside App_Resources/iOS/build.xcconfig will be ignored. And the application build will most probably fail.
  • Local frameworks (not SDK ones) will not be included in the build of the watch app.
  • Single watch app can be added to the project.
  • If the WatchApp Extension has an entitlements file and a space in the name of the extension or the .entitlements file, the prepare step of the project will fail. - #5005

Discussion

Please, don't report problems here. Instead, open a new issue and link it to this one.
Let's use this discussion for suggestions and improvement ideas. We would love to hear from you!

主要语言
JavaScript
星标
1.1k
派生
204
平均合并
1 天 9 小时
30 天内合并 PR
8

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

NativeScript/nativescript-cli 的其他 Issue

查看 NativeScript/nativescript-cli 的全部 Issue

相似的 Issue

更多 JavaScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。