NativeScript / NativeScript/nativescript-cli

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

Đang mở
#4,589 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

os: ios
Ngôn ngữ chính
JavaScript
Star
1.1k
Fork
204
Merge trung bình
1 ngày 9 giờ
Pull request đã merge (30 ngày)
8

Mô tả

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!

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Hướng nghiên cứu

Đây là một issue để theo dõi và thảo luận; hãy bắt đầu với feature issue được liên kết #4541 và xem lại workflow Xcode đã được ghi lại bằng cách sử dụng App_Resources/iOS/watchapp và watchextension. Payload không nêu tệp nguồn hay bài kiểm thử nào, và việc hoàn thành không được định nghĩa ngoài hành vi tổng quát của watch-app và các vấn đề đã biết được liệt kê.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
ios, javascript
Lĩnh vực
cli, mobile-dev
Loại issue
Tính năng
Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Cần làm rõ
Mức phù hợp với người mới
25/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.