NativeScript / NativeScript/nativescript-cli
[Tracking][Beta] Embedding Apple Watch App inside NativeScript App
Personne n'a encore pris cette issue.
- Langage dominant
- JavaScript
- Étoiles
- 1.1k
- Forks
- 204
- Merge moyen
- 1 j 9 h
- PR mergées (30 j)
- 8
Description
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:
- Create Single Page App from Xcode.
- Add watch app target - File>New>Target>WatchKit App
- Add a name to your watch app, for example
MyFirstWatchApp - Copy the generated "MyFirstWatchApp" and
MyFirstWatchApp Extensionto.../apps/MyApp/app/App_Resources/iOS/watchapp/MyFirstWatchAppand.../apps/MyApp/app/App_Resources/iOS/watchextension/MyFirstWatchApp Extensionrespectively. - Inside the
Info.plistof the Watch App replace the value ofWKCompanionAppBundleIdentifierwith$(WK_APP_BUNDLE_IDENTIFIER).
6 Inside theInfo.plistof the Watch Extension replace the value ofWKAppBundleIdentifierwith$(WK_APP_BUNDLE_IDENTIFIER). - You can populate the
Assets.xcassetsof the Watch App and the Watch Extension and add the name of theappiconsetto the.../apps/MyApp/app/App_Resources/iOS/watchapp/MyFirstWatchApp/watchapp.jsonand.../apps/MyApp/app/App_Resources/iOS/watchextension/MyFirstWatchApp Extension/extension.jsonrespectively:
{
"assetcatalogCompilerAppiconName": "AppIcon"
}
- You can modify the
WATCHOS_DEPLOYMENT_TARGETof the Watch App by adding the value inside thewatchapp.jsonlike this:
{
"assetcatalogCompilerAppiconName": "AppIcon",
"targetBuildConfigurationProperties": {
"WATCHOS_DEPLOYMENT_TARGET": 4.1
}
}
- Run the NativeScript application
Known issues
- The watch app inside NativeScript application support only
Automaticcode signing. Any provision configuration insideApp_Resources/iOS/build.xcconfigwill 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
.entitlementsfile, 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!
Guide de contribution
Ouvrir le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Piste de recherche
Il s’agit d’une issue de suivi et de discussion ; commencez par l’issue de fonctionnalité liée #4541 et examinez le workflow Xcode documenté à l’aide de App_Resources/iOS/watchapp et watchextension. Le payload ne mentionne aucun fichier source ni test, et l’achèvement n’est pas défini au-delà du comportement général de la watch-app et des problèmes connus répertoriés.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- ios, javascript
- Domaine
- cli, mobile-dev
- Type d'issue
- Fonctionnalité
- Difficulté
- 5/5
- Temps estimé
- Plus d'une semaine
- Activité
- À l'abandon
- Clarté
- À clarifier
- Accessibilité débutants
- 25/100