标签: ionic-framework

错误:使用 OneSignal 推送注册时遇到错误:错误域=OneSignalError Code=400”

我在将一个信号集成到我的 iOS 应用程序时遇到了一个问题,我遵循了离子指南和一个信号中的所有内容,但收到此错误

错误:在使用 OneSignal 推送注册过程中遇到错误:错误域=OneSignalError Code=400 "(null)" UserInfo={returned={ errors = ( "app_id not found。您可能缺少 Content-Type: application/json 标头。 "); }}

我确定app_id是正确的

任何机构帮助这是我的代码:

platform.ready().then(() => {


  // Okay, so the platform is ready and our plugins are available.
  // Here you can do any higher level native things you might need.
  statusBar.styleDefault();
  splashScreen.hide();

if(platform.is('ios')){
    console.log('platform is ios using onsignail for ios');
    this.oneSignal.startInit('bae0c3e1-bc4e-49ab-9274-18635XXXXX', );

this.oneSignal.inFocusDisplaying(this.oneSignal.OSInFocusDisplayOption.InAppAlert);

this.oneSignal.handleNotificationReceived().subscribe(() => {
    // do something when notification is received
});

this.oneSignal.handleNotificationOpened().subscribe(() => {
    // …
Run Code Online (Sandbox Code Playgroud)

xcode push-notification ionic-framework onesignal

7
推荐指数
1
解决办法
2535
查看次数

找不到与 com.google.android.gms:strict-version-matcher-plugin:[15.0.0, 16.0.0) 匹配的任何版本

该项目一直运行良好,直到两天前突然发生错误。我不知道如何解决它,因为我已经做了我能做的一切,包括重新安装 android studio 和 gradle。

无法解析配置 ':app:debugCompileClasspath' 的所有文件。找不到与 com.google.android.gms:strict-version->matcher-plugin:[15.0.0, 16.0.0) 匹配的任何版本。不匹配的版本:1.1.0 1.0.3 1.0.2 1.0.1 1.0.0 需要:项目 :app > com.google.gms:google-services:4.2.0

build.gradle(应用程序)

apply plugin: 'com.android.application'

buildscript {
    repositories {
        mavenCentral()
        maven {
            url "https://maven.google.com"
        }
        jcenter()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.1'
      classpath 'com.google.gms:google-services:4.1.0'
    }
}

// Allow plugins to declare Maven dependencies via build-extras.gradle.
allprojects {
    repositories {
        mavenCentral();
        jcenter()
    }
}

task wrapper(type: Wrapper) {
    gradleVersion = '4.1.0'
}

// Configuration properties. Set these via environment variables, build-extras.gradle, or gradle.properties.
// …
Run Code Online (Sandbox Code Playgroud)

android gradle build.gradle ionic-framework

7
推荐指数
1
解决办法
5246
查看次数

PWA 离线时的图像存储

我正在为我现有的托管网站构建手动 PWA(不使用框架 IONIC、React 等)。我的基本要求是我想从我的手机相机中捕捉照片。但条件是: 1. 当我拍摄图片时,我将完全离线。2.我想把它上传到服务器意味着数据库中。但是当我离线时,我想将其存储在 localstorage 中,当我在 3 天后重新上线时,它将恢复剩余的内容并自动将图像上传到服务器。

我尝试使用 javascript 但没有得到那么多。我想要的基本方法是:

if(camera clicked)->
   if(upload btn clicked)-> 
        if(device is online)-> 
           upload to the server;
           (**or I can call one function here which can upload the image to server.)
        else if(device is offline)->
           upload to localstorage;
//again when device gets online I will call one **function(which is I am calling from **) in constructor which get executed everytime when site is reloaded or app is opened. 

My ** function will …
Run Code Online (Sandbox Code Playgroud)

offline-mode local-storage ionic-framework progressive-web-apps

7
推荐指数
1
解决办法
3057
查看次数

错误:无法匹配任何路由。URL 段:“标签”

我正在尝试为我的 ionic 4 应用程序创建标签页布局。在我的配置和设置之后,我收到错误错误:无法匹配任何路由。URL 段:“标签”

首先,当我使用标签模板创建默认启动器时,它不起作用。选项卡栏显示但不显示选项卡内容。经过几天的研究和测试,还没有运气。看看我现在有什么;

我的离子信息

Ionic:
   ionic (Ionic CLI)             : 4.6.0 (C:\Users\Ken\AppData\Roaming\npm\node_modules\ionic)
   Ionic Framework               : @ionic/angular 4.0.0-beta.17
   @angular-devkit/build-angular : 0.10.7
   @angular-devkit/schematics    : 7.0.7
   @angular/cli                  : 7.0.7
   @ionic/angular-toolkit        : 1.2.0

System:

   NodeJS : v10.13.0 (C:\Program Files\nodejs\node.exe)
   npm    : 6.4.1
   OS     : Windows 10
Run Code Online (Sandbox Code Playgroud)

app-routing.module.ts

import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';

const routes: Routes = [
  {
    path: '',
    redirectTo: 'home',
    pathMatch: 'full'
  },
  {
    path: 'home',
    loadChildren: './home/home.module#HomePageModule'
  },
  { path: 'tabs', …
Run Code Online (Sandbox Code Playgroud)

ionic-framework angular ionic4

7
推荐指数
2
解决办法
1万
查看次数

在 Angular 5 中,如何从父组件访问动态添加的子组件?

我正在开发一个 Ionic + Angular 5 项目。

我需要动态加载一些组件。按照Angular 文档中的动态组件加载器示例,我能够成功加载组件并显示它们。

但是,我需要能够遍历加载的组件。

在创建和销毁子组件时,我可以轻松地在父组件中维护自己的组件列表,但在我看来,这很丑陋,而不是“角度方式”。

经过大量实验和研究,似乎我无法使用 @ViewChildren 访问动态添加的组件,因为它们有自己的视图。ViewChildren 未找到动态组件

这样对吗?

我可以使用 viewContainerRef.get() 遍历子视图并检索 ViewRefs。但是似乎没有办法在给定 ViewRef 的情况下获得对组件的引用?

我注意到 ViewRef 的“rootNodes”属性,但是该属性没有记录在 Angular 文档视图参考中。但是,它记录在 EmbeddedViewRef 文档嵌入式视图参考中,但似乎仍然没有让我访问组件。

所以问题是当我有一个动态添加子组件的父级时,我如何从父级循环到子组件(这样我就可以在子级中调用我的方法之一)?我怀疑是我遗漏了一些愚蠢的简单东西,有一些根本的误解,或者我应该使用不同的模式。

我修改了 Dynamic Component Loader 示例以突出显示我正在尝试做的事情。修改后的动态组件加载器

javascript typescript ionic-framework angular

7
推荐指数
1
解决办法
1725
查看次数

无法找到管道“翻译”错误显示在 Ionic 4 中

我正在使用 Ionic 4 应用程序并安装了该ngx-translate插件。它工作正常,app.component.html但tabs.page.html显示错误。

找不到管道“翻译”

这是我的app.component.html:

<ion-list class="mylist22" color="myheader">
    <ion-item color="myheader">
        <ion-label>Gender</ion-label>
        <ion-select [(ngModel)]="languageSelected" (ionChange)='setLanguage()'>
            <ion-select-option value="en" selected>English</ion-select-option>
            <ion-select-option value="ar">Arabic</ion-select-option>
        </ion-select>
    </ion-item>
</ion-list>
Run Code Online (Sandbox Code Playgroud)

在这个视图中,我有语言选择框。

这是我的app.component.ts:

import { TranslateService } from '@ngx-translate/core';

@Component({
  selector: 'app-root',
  templateUrl: 'app.component.html'
})
export class AppComponent {
  languageSelected: any = 'en';
  constructor(
    private platform: Platform,
    private splashScreen: SplashScreen,
    private statusBar: StatusBar,
    private translate: TranslateService
  ) {
    this.translate.addLangs(['en', 'ar']);
    this.translate.setDefaultLang('en');
    this.initializeApp();
  }

  initializeApp() {
    this.platform.ready().then(() => { …
Run Code Online (Sandbox Code Playgroud)

ionic-framework ngx-translate angular ionic4

7
推荐指数
1
解决办法
6277
查看次数

Ionic android build 生成未签名的 apk,但不要安装在我的 android 8.1.0 中

当我提供 ionic 应用程序时,它可以在浏览器中运行,但用于 android 的构建 apk 不起作用。apk 无法安装。

我试过 ionic cordova build android --release

带有以下消息的构建通过

Checking Java JDK and Android SDK versions
ANDROID_SDK_ROOT=undefined (recommended setting)
ANDROID_HOME=C:\Users\ruban\AppData\Local\Android\Sdk (DEPRECATED)
Subproject Path: CordovaLib
Subproject Path: app
> Task :app:preBuild UP-TO-DATE
> Task :CordovaLib:preBuild UP-TO-DATE
> Task :CordovaLib:preReleaseBuild UP-TO-DATE
> Task :CordovaLib:checkReleaseManifest UP-TO-DATE
> Task :CordovaLib:processReleaseManifest UP-TO-DATE
> Task :app:preReleaseBuild UP-TO-DATE`
Run Code Online (Sandbox Code Playgroud)
D:\myApp\platforms\android\app\src\main\res\drawable-land-hdpi\screen.png: Error: The drawable "screen" in drawable-land-hdpi has no declaration in the base drawable folder or in a drawable-densitydpi folder; this can lead …
Run Code Online (Sandbox Code Playgroud)

cordova ionic-framework

7
推荐指数
1
解决办法
7176
查看次数

离子 android 构建失败,找不到插件“提案数字分隔符”

我的应用程序在浏览器中运行良好,并在启动 android 构建时使用 Cordova Geolocation 作为插件出现此错误

An unhandled exception occurred: [BABEL] /Users/suatkarabacak/Desktop/quarantine/www/2-es2015.js: Could not find plugin "proposal-numeric-separator". Ensure there is an entry in ./available-plugins.js for it. (While processing: "/Users/suatkarabacak/Desktop/quarantine/node_modules/@babel/preset-env/lib/index.js")
See "/private/var/folders/2n/czcjwx7554j_h2hpsj53h81m0000gn/T/ng-ZxzGC4/angular-errors.log" for further details.
[ERROR] An error occurred while running subprocess ng.
Run Code Online (Sandbox Code Playgroud)

来自 package-lock.json

"@babel/preset-env": {
      "version": "7.8.3",
      "resolved": "https://registry.npmjs.org/@babel/preset-env/-/preset-env-7.8.3.tgz",
      "integrity": "sha512-Rs4RPL2KjSLSE2mWAx5/iCH+GC1ikKdxPrhnRS6PfFVaiZeom22VFKN4X8ZthyN61kAaR05tfXTbCvatl9WIQg==",
      "dev": true,
      "requires": {
        "@babel/compat-data": "^7.8.0",
        "@babel/helper-compilation-targets": "^7.8.3",
        "@babel/helper-module-imports": "^7.8.3",
        "@babel/helper-plugin-utils": "^7.8.3",
        "@babel/plugin-proposal-async-generator-functions": "^7.8.3",
        "@babel/plugin-proposal-dynamic-import": "^7.8.3",
        "@babel/plugin-proposal-json-strings": "^7.8.3",
        "@babel/plugin-proposal-nullish-coalescing-operator": "^7.8.3",
        "@babel/plugin-proposal-object-rest-spread": "^7.8.3",
        "@babel/plugin-proposal-optional-catch-binding": "^7.8.3",
        "@babel/plugin-proposal-optional-chaining": "^7.8.3",
        "@babel/plugin-proposal-unicode-property-regex": "^7.8.3", …
Run Code Online (Sandbox Code Playgroud)

android cordova ionic-framework cordova-plugins babeljs

7
推荐指数
2
解决办法
5481
查看次数

离子验证 - 显示错误信息,如材料

我一直在研究 Ionic 5 中的登录和注册页面。我想在输入文本字段下方显示错误消息,如下所示

在此处输入图片说明

所以我实现了 Angular Responsive Forms

  ngOnInit() {
    this.afAuth.authState.subscribe(data => console.log(data));

    this.myForm = this.fb.group({
      email: ['', [
        Validators.required,
        Validators.email
      ]],
      password: ['', [
        Validators.required,
        Validators.pattern('^(([a-zA-Z][^:.*/}{;])*\d*)$')
      ]]
    });
  }

  get email(){
    return this.myForm.get('email');
  }

  get password(){
    return this.myForm.get('password');
  }

Run Code Online (Sandbox Code Playgroud)

这样做之后,我创建了一个带有两个离子输入字段的表单。

<ion-item class="input_item">
  <ion-label position="floating">E-Mail</ion-label>
  <ion-input formControlName="email" position="floating"></ion-input>
</ion-item>

<div class="validation-errors">
    <div class="error-message" *ngIf="email.errors && email.dirty || email.touched">
      Your E-Mail is invalid!
    </div>
</div>
Run Code Online (Sandbox Code Playgroud)

我尝试使用此类“验证错误”,但它没有按照我想要的方式显示消息。我设法让它看起来像这样

在此处输入图片说明

但是是否有一些更简单的方法可以像 Angular Material 那样显示错误消息?我可以使用 Ionic 的某些东西,还是必须实现 Angular Material UI 组件?

谢谢回答。

更新:自从我的原始帖子以来,这个问题已经获得了一些关注,并且似乎没有更简单的解决方案,我想为经过的任何人发布使用过的样式:

.validation-errors { …
Run Code Online (Sandbox Code Playgroud)

validation user-interface ionic-framework angular-material angular

7
推荐指数
1
解决办法
768
查看次数

如何将 Ionic Cordova 3 迁移到 Ionic Cordova 5?

我有Ionic 3项目,我必须升级到Ionic 5。请需要升级项目的最佳方式。

ionic-framework ionic3 ionic5

7
推荐指数
1
解决办法
5234
查看次数