标签: nativescript

aws-amplify 对 appsync 的订阅在 2 分钟后停止

当使用 amplify 订阅 appsync 时,使用API.graphql(graphqlOperation(subscription));订阅可以工作一段时间,但我收到套接字关闭错误。

CONSOLE LOG [native code]: {
"[INFO] 24:12.893 MqttOverWSProvider": {
"errorCode": 8,
"errorMessage": "AMQJS0008I Socket closed.",
"uri": "wss://<uri>
Run Code Online (Sandbox Code Playgroud)

相同的订阅在 appsync 控制台中运行没有任何问题,只要订阅正在运行,我就会收到事件,但在设备上大约 2 分钟后停止。

涉及代码

let cs = await this.subscriptionService.appSubscriptions();
    this.sbscriptions = this.cs.subscribe({
      next: data => {
        console.dir(data);
              },
      error: error => console.dir(JSON.stringify(error)),
      close: () => console.log("closed")
 });
Run Code Online (Sandbox Code Playgroud)

这部分代码不会抛出任何错误,上面显示的错误仅在设置时可见LOG_LEVEL = DEBUG

注意:在出现此错误之前,订阅确实会工作一段时间,在那段时间我可以看到从控制台触发的所有事件。

nativescript aws-appsync aws-amplify

5
推荐指数
0
解决办法
1818
查看次数

如何获取 NativeScript 中的状态栏高度?

Android 和 iOS 的不同版本的操作系统有不同大小的状态栏。使用本机脚本,我怎样才能算出这个高度是多少?

我需要它,这样我就可以在应用程序的顶部添加一个与状态栏大小相同的填充,否则它会与我的应用程序内容的不同数量重叠。

android styling ios nativescript

5
推荐指数
0
解决办法
935
查看次数

Nativescript-vue 不实时更新

我曾经运行命令:tns run android --bundle。当我保存更改时,它们会在物理和虚拟 Android 模拟器中自动更新。

现在,当我保存更改时,没有任何反应,必须再次运行命令才能查看更改。

当我保存项目时,出现以下消息:

File change detected. Starting incremental webpack compilation...
Hash: 2e482eb5460af6f4127a
Version: webpack 4.27.1
Time: 1119ms
Built at: 12/04/2019 11:31:32 AM
                                    Asset      Size   Chunks             Chunk Names
     a3a53c6e399658f9e1f5.hot-update.json  48 bytes           [emitted]
bundle.a3a53c6e399658f9e1f5.hot-update.js  10.1 KiB   bundle  [emitted]  bundle
                                bundle.js   892 KiB   bundle  [emitted]  bundle
                               runtime.js  71.4 KiB  runtime  [emitted]  runtime
 + 1 hidden asset
Entrypoint bundle = runtime.js vendor.js bundle.js bundle.a3a53c6e399658f9e1f5.hot-update.js
[../node_modules/nativescript-dev-webpack/style-hot-loader.js!../node_modules/nativescript-dev-webpack/apply-css-loader.js!../node_modules/css-loader/dist/cjs.js?!../node_modules/vue-loader/lib/loaders/stylePostLoader.js!../node_modules/vue-loader/lib/index.js?!./pages/VistaPrueba.vue?vue&type=style&index=0&id=f4390c96&scoped=true&lang=css&] ../node_modules/nativescript-dev-webpack/style-hot-loader.js!../node_modules/nativescript-dev-webpack/apply-css-loader.js!../node_modules/css-loader/dist/cjs.js??ref--1-2!../node_modules/vue-loader/lib/loaders/stylePostLoader.js!../node_modules/vue-loader/lib??vue-loader-options!./pages/VistaPrueba.vue?vue&type=style&index=0&id=f4390c96&scoped=true&lang=css& 1.26 KiB {bundle} [built]
[../node_modules/ts-loader/index.js?!../node_modules/vue-loader/lib/index.js?!./pages/VistaPrueba.vue?vue&type=script&lang=ts&] ../node_modules/ts-loader??ref--4!../node_modules/vue-loader/lib??vue-loader-options!./pages/VistaPrueba.vue?vue&type=script&lang=ts& 1.12 KiB {bundle} [built]
[../node_modules/vue-loader/lib/loaders/templateLoader.js?!../node_modules/vue-loader/lib/index.js?!./pages/VistaPrueba.vue?vue&type=template&id=f4390c96&scoped=true&] …
Run Code Online (Sandbox Code Playgroud)

vue.js nativescript nativescript-vue

5
推荐指数
1
解决办法
1765
查看次数

如何放入Info.plist 2 &lt;key&gt;CFBundleURLTypes&lt;/key&gt;

我想使用来自 google 和 facebook 的身份验证插件

我想放入Info.plist

对于谷歌:

<key>CFBundleURLTypes</key>
    <array>
        <dict>
            <key>CFBundleTypeRole</key>
            <string>Editor</string>
            <key>CFBundleURLName</key>
            <string>REVERSED_CLIENT_ID</string>
            <key>CFBundleURLSchemes</key>
            <array>
                <string>com.googleusercontent.apps.1052836194035-l81fsjai1u40ocnqjcpnoebnnsltt03b</string>
            </array>
        </dict>
    </array>
Run Code Online (Sandbox Code Playgroud)

对于脸书:

<key>CFBundleURLTypes</key>
<array>
  <dict>
    <key>CFBundleURLSchemes</key>
    <array>
      <string>fb{your-app-id}</string>
    </array>
  </dict>
</array>
<key>FacebookAppID</key>
<string>{your-app-id}</string>
<key>FacebookDisplayName</key>
<string>{your-app-name}</string>
<key>LSApplicationQueriesSchemes</key>
<array>
  <string>fbapi</string>
  <string>fb-messenger-share-api</string>
  <string>fbauth2</string>
  <string>fbshareextension</string>
</array>
Run Code Online (Sandbox Code Playgroud)

如何在一个 Info.plist 中同时使用两者?

当我在 facebook 中删除 CFBundleURLTypes 时,在控制台中显示错误:解析时缺少密钥

有什么想法吗?

info.plist ios firebase google-cloud-platform nativescript

5
推荐指数
1
解决办法
6014
查看次数

带有标签/路由器插座的子路由不起作用。“错误:无法匹配任何路由。URL 段”

当我尝试以下操作时:

const routes: Routes = [
  {
    path: "", component: RegisteredLayoutComponent, canActivate: [AuthGuard], children: [
      {
        path: '',
        redirectTo:
          "/(topicsTab:topicsPage//newsTab:newsPage//homeTab:homePage//askTab:askPage//moreTab:morePage)",
        pathMatch: "full"
      },
      { path: 'home', component: HomePageComponent, outlet: "homeTab" },...

{ path: '**', redirectTo: '' }
Run Code Online (Sandbox Code Playgroud)

我收到“错误:无法匹配任何路由。URL 段”

难道我做错了什么?包含路由器插座的页面如下所示:

<BottomNavigation selectedIndex="2">
    <TabStrip backgroundColor="white">
        <TabStripItem>
            <Label text="Topics" class="icon__color"></Label>
            <Image src="~/assets/round_people_black_18dp.png" class="fas t-36 icon__color"></Image>
        </TabStripItem>
        <TabStripItem class="special">
            <Label text="News" class="icon__color"></Label>
            <Image src="~/assets/round_local_library_black_18dp.png" class="fas t-36 icon__color"></Image>
        </TabStripItem>
        <TabStripItem class="special">
            <Label text="Home" class="icon__color"></Label>
            <Image src="~/assets/round_home_black_18dp.png" class="fas t-36 icon__color"></Image>
        </TabStripItem>
        <TabStripItem class="special">
            <Label text="Ask?" …
Run Code Online (Sandbox Code Playgroud)

nativescript angular

5
推荐指数
1
解决办法
246
查看次数

nativescript 搭档停产了吗?

每当我单击 window 的 nativeScript sidekick 下载链接时,它都会将我重定向到主页。我在那里没有看到 nativescript 助手的任何下载链接。所以我寻找关于sidekick是否停产的信息,但我什么也没找到。如果有人有 nativescript 助手的下载链接或有关停止使用的信息,请分享谢谢

nativescript nativescript-sidekick

5
推荐指数
1
解决办法
2625
查看次数

带有 Vuex 的 Nativescript Vue Timepicker

我正在开发一个 Nativescript-Vue 应用程序,我正在尝试使用 Vuex 从 Timepicker 存储小时和分钟以在其他页面中使用。我试过用计算属性来捕捉事件,但是有没有更好的方法用 Vue 来做到这一点?

这是我所拥有的:

// In NotifyTimePicker.vue (a custom Time-picking modal)
// Template:
<TimePicker row="2" col="0" colSpan="3" horizontalAlignment="center" :hour="selectedFromHour" :minute="selectedFromMinute" />

//Script
computed: {
      selectedFromHour: {
        get: function () {
          return this.$store.state.notifyFromTimeHour
        },
        set: function (newValue) {
          console.log(`Attempting to Update Store with new From Hour = ${newValue}`)
          this.$store.commit('changeNotifyFromTimeHour', newValue)
        }
      },
      selectedFromMinute: {
        get: function () {
          return this.$store.state.notifyFromTimeMinute
        },
        set: function (newValue) {
          console.log(`Attempting to Update Store with new From Minute = ${newValue}`) …
Run Code Online (Sandbox Code Playgroud)

javascript vue.js nativescript vuex nativescript-vue

5
推荐指数
1
解决办法
141
查看次数

运行“ng生成组件”时,本机脚本错误“无法读取未定义的属性“种类”

我无法向我的 Nativescript 项目添加新组件,当我执行ng generate component faqs它时返回错误:

Option "entryComponent" is deprecated: Since version 9.0.0 with Ivy, entryComponents is no longer necessary.
Cannot read property 'kind' of undefined
Run Code Online (Sandbox Code Playgroud)

或者如果我运行它就像ng generate component它问我组件名称一样

? What name would you like to use for the component? faqs
Run Code Online (Sandbox Code Playgroud)

并返回

Option "entryComponent" is deprecated: Since version 9.0.0 with Ivy, entryComponents is no longer necessary.
Cannot read property 'match' of undefined
Run Code Online (Sandbox Code Playgroud)

我在用:

Nativescript 7.0.10

Angular CLI: 10.1.4
Node: 12.18.4
OS: win32 x64

Angular: 10.1.4
... …
Run Code Online (Sandbox Code Playgroud)

typescript nativescript nativescript-angular angular

5
推荐指数
1
解决办法
956
查看次数

如何让 Jest 正确转译 node_modules/@nativescript/core ?玩笑 + NativeScript + Angular + Nx

我目前正在尝试使用 Nx monorepo 工具设置一个多平台代码共享入门项目。该项目将 Angular 用于 Web,并使用 NativeScript 用于跨平台移动设备。

\n

理想情况下,我希望能够使用 Jest 来运行所有单元测试。目前,我可以使用根目录中的 jest 成功运行单元测试。它们对于 Angular 应用程序及其库正确执行,但在尝试为 NativeScript (NativeScript Angular) 项目执行单元测试时遇到错误,特别是当这些单元测试导入 NativeScript 组件时(即实际上有用)。也就是说,虚拟测试期望true能够true正常工作,因此 Jest 可以毫无问题地找到并运行测试。但是当我尝试导入组件时,我遇到了问题。

\n

我已经解决了一些问题。最初我收到的错误是:

\n
  \xe2\x97\x8f Test suite failed to run\n\n    Jest encountered an unexpected token\n\n    This usually means that you are trying to import a file which Jest cannot parse, e.g. it's not plain JavaScript.\n\n    By default, if Jest sees a Babel config, it will use that to transform your files, ignoring …
Run Code Online (Sandbox Code Playgroud)

typescript jestjs nativescript angular nrwl

5
推荐指数
1
解决办法
993
查看次数

预览服务已被禁用,直至另行通知。配置本地构建并在 Svelte Native 上运行 ns 预览时使用“ns run”

我是 Svelte Native 的新手。我正在遵循文档上的快速入门步骤。安装nativescript和创建新的 Svelte-Native 应用程序npx degit halfnelson/svelte-native-template myapp没有问题。

在此输入图像描述

但是,在我cd myapp运行之后ns preview(立即继续上面的屏幕截图):

在此输入图像描述

注意:我在第二次尝试时做了,因为我在文档的屏幕截图上看到了这一点,只是为了测试它并看看它是否会工作(但它也没有)。tnspreview

那么我应该等到预览服务启用吗?如果没有,我不知道如何配置本地构建并使用“ns run”代替。我该怎么做?

nativescript svelte-native

5
推荐指数
1
解决办法
1683
查看次数