我找不到在 Ionic 5 系统中关闭应用程序的方法。看起来 Ionic 4 中的方法不适用于 Ionic 5。可以吗?
我正在尝试使用电容器来实现本地通知。
首先我使用以下命令安装插件,
npm install @ionic-native/local-notifications
npm install cordova-plugin-local-notification
Run Code Online (Sandbox Code Playgroud)
然后在我的 .js 文件中,我添加了以下代码
import { Plugins } from '@capacitor/core';
Run Code Online (Sandbox Code Playgroud)
和
scheduleNotification = () => {
Plugins.LocalNotifications.schedule({
notifications: [
{
title: "Title",
body: "Body",
id: 1,
schedule: { at: new Date(Date.now() + 1000 * 5) },
sound: null,
attachments: null,
actionTypeId: "",
extra: null
}
]
});
console.log('scheduled notifications');
Run Code Online (Sandbox Code Playgroud)
}
我尝试了所有方法,但在运行 iOS 12 的 iPhone 6s 上看不到任何本地通知。当我检查 Xcode 日志时,我可以看到 id 为 1 的计划通知。
cordova-plugin-badge (0.8.8)
cordova-plugin-device (2.0.3)
cordova-plugin-local-notification (0.9.0-beta.2)
Run Code Online (Sandbox Code Playgroud) 我正在尝试使用 VSCode 中的以下命令使用 Cordova 为 Android 设备构建一个离子应用程序。
ionic cordova build android --prod --release
Run Code Online (Sandbox Code Playgroud)
但我收到这个错误:
cordova.cmd build android --release
Checking Java JDK and Android SDK versions
ANDROID_SDK_ROOT=undefined (recommended setting)
ANDROID_HOME=C:\Users\tanmay\AppData\Local\Android\sdk (DEPRECATED)
Could not find an installed version of Gradle either in Android Studio,
or on your system to install the gradle wrapper. Please include gradle
in your path, or install Android Studio
[ERROR] An error occurred while running subprocess cordova.
cordova.cmd build android --release exited with exit code 1.
Run Code Online (Sandbox Code Playgroud)
我已经安装了JDK、Android Studio。 …
cordova android-studio ionic-framework ionic5 android-studio-3.6.1
为什么当我在另一个模态之上打开一个模态时,我的离子背景 + 模态阴影样式不起作用?
前言:这在 V4 上运行良好,但在升级到 V5 时出现故障。我不想更改我的页面方法,只需修复 CSS/任何实际导致以下问题的内容。
我的应用程序打开一个带有自定义 css 的模式页面以使其全屏显示。
然后我可以在顶部打开另一个正常模式(但不是全屏)。第二个模式缺少离子背景及其边框阴影样式。
我可以看到 ion-backdrop 肯定在 DOM 中,但显然没有显示。
Step1 Fine 在此输入图片说明
第 2 步 - 破碎的离子背景: 在此处输入图像描述
显示我的自定义模式:
async showClipboard() {
const modal = await this._ModalController.create({
component: ClipboardPage,
cssClass: 'custom-round-modal',
componentProps: {
user: this.user
},
showBackdrop: true
});
await modal.present();
}
Run Code Online (Sandbox Code Playgroud)
CSS:
@media only screen and (min-width: 768px) {
.custom-round-modal {
.modal-wrapper {
border-radius: 15px !important;
-moz-border-radius: 15px !important;
-webkit-border-radius: 15px !important;
.ion-page {
border-radius: 15px !important;
-moz-border-radius: 15px !important; …Run Code Online (Sandbox Code Playgroud) 我遇到了如何使用 Ionic5 Angular 在我的 iOs 模拟器中呈现 google maps InfoWindow 的问题。
这是一张图片:
如您所见,填充不一致,尤其是在最右侧的文本与 InfoWindow 边界相对的位置。这可能是一个时间问题,因为如果我将 InfoWindow(使用 setTimeout())的创建延迟几秒钟,它通常会正确呈现。
当我模拟同一个项目时,这不会在 Android 中发生,因为该平台上的填充是正确的。我尝试手动为 InfoWindow 内容添加样式,但没有任何理由需要有选择地向 iO 添加填充而不是 Android。我也不应该添加任意超时。
如果有人有任何想法,将不胜感激。我已经尽可能地简化了代码。
模拟器是 iPhone 11 (13.2.2)。
这是我的离子信息:
Ionic:
Ionic CLI : 5.4.2
Ionic Framework : @ionic/angular 5.1.1
@angular-devkit/build-angular : 0.803.23
@angular-devkit/schematics : 8.1.3
@angular/cli : 8.1.3
@ionic/angular-toolkit : 2.2.0
Cordova:
Cordova CLI : 9.0.0 (cordova-lib@9.0.1)
Cordova Platforms : android 8.1.0, ios 5.1.1
Cordova Plugins : cordova-plugin-ionic-keyboard 2.2.0, cordova-plugin-ionic-webview 4.1.3, (and 28 other plugins)
Utility:
cordova-res : 0.6.0 …Run Code Online (Sandbox Code Playgroud) 无论变量如何--target,以下命令都会失败:
ionic cordova run ios --target="iPhone-X"
ionic cordova run ios --target="iPhone 12"
ionic cordova emulate ios --debug --target="iPhone 11" -- --buildFlag="-UseModernBuildSystem=0"
Run Code Online (Sandbox Code Playgroud)
错误是:
[native-run] ERR_DEVICE_LOCKED: Device still locked after 1 minute. Aborting.
[ERROR] An error occurred while running subprocess native-run.
Run Code Online (Sandbox Code Playgroud)
在我切换到 Apple Silicon (M1) MacBook Pro 后,就会发生这种情况,但我不能 100% 确定。谢谢!
我正在开发ionic capacitor具有 firebase 电话身份验证功能的应用程序。我已遵循 firebase 文档,并将代码设置为身份验证电话,并使用 firebase 发送 otp 和验证。它在浏览器和 Android 设备中运行良好。我正在获取 otp,我也可以验证它,但现在我正在创建 ios 构建并发现我遇到了一些错误
code: "auth/operation-not-supported-in-this-environment"
message: "RecaptchaVerifier is only supported in a browser HTTP/HTTPS environment."
Run Code Online (Sandbox Code Playgroud)
请在下面找到我的代码
recaptchaVerifier: firebase.auth.RecaptchaVerifier;
ionViewDidLoad() {
this.recaptchaVerifier = new firebase.auth.RecaptchaVerifier('sign-in-button', {
size: 'invisible',
callback: (response) => {
},
'expired-callback': () => {
}
});
}
signInWithPhoneNumber() {
this.authService.signInWithPhoneNumber(this.recaptchaVerifier, +19898989898).then(
success => {
this.verifyPhone();
}).catch(error => this.afterLoginError(error));
}
Run Code Online (Sandbox Code Playgroud)
所以问题只出在ios上
javascript firebase firebase-authentication capacitor ionic5
我正在尝试生成 Android 和 Ionic 文件夹,但出现以下错误:
% ionic cap add ios
Error: Non-zero exit from subprocess.
at Integration.<anonymous> (/usr/local/lib/node_modules/@ionic/cli/lib/integrations/capacitor/index.js:46:27)
at async AddCommand.getInstalledPlatforms (/usr/local/lib/node_modules/@ionic/cli/commands/capacitor/base.js:117:21)
at async AddCommand.installPlatform (/usr/local/lib/node_modules/@ionic/cli/commands/capacitor/base.js:239:36)
at async AddCommand.run (/usr/local/lib/node_modules/@ionic/cli/commands/capacitor/add.js:41:9)
at async Promise.all (index 0)
at async AddCommand.execute (/usr/local/lib/node_modules/@ionic/cli/lib/command.js:81:9)
at async Executor.run (/usr/local/lib/node_modules/@ionic/cli/lib/executor.js:54:9)
at async Executor.execute
(/usr/local/lib/node_modules/@ionic/cli/node_modules/@ionic/cli-framework/lib/executor.js:70:13)
at async Object.run (/usr/local/lib/node_modules/@ionic/cli/index.js:110:9)
Run Code Online (Sandbox Code Playgroud)
我已经重新安装了 Ionic、Cap、Cocoa Apds,但没有解决
我正在使用 Cordova 和 Angular 11 开发 Ionic 5 应用程序,目前正在使用 SafetyNet Google API 来检测已 root 的设备。但是,我遇到了一个问题,当用户使用带有拒绝列表选项的 Magisk Manager 应用程序时,安全检查被绕过。
在参考Google官方文档后,我了解到SafetyNet API已被弃用,他们建议使用较新的Play Integrity API。我想知道如何将 Play Integrity API 与 Angular 11 集成到我的 Ionic 5 Cordova 应用程序中。
具体来说,我正在寻求以下方面的指导:
我广泛搜索了相关资源和文档,但没有找到任何将 Play Integrity API 集成到 Ionic 5 Cordova 应用程序与 Angular 11 中的具体示例或教程。
任何指导、代码示例或相关文档的引用将不胜感激。此外,如果在实施此集成时我应该注意任何注意事项或最佳实践,请告诉我。
当我为 Ionic 5 应用程序提供服务时,出现以下错误:
\nUncaught TypeError: Failed to construct \'HTMLElement\': Please use the \'new\' operator, this DOM object constructor cannot be called as a function.\n at Reflect.<anonymous> (js?key=MY_API_KEY&v=3.exp&callback=initMap&libraries=places:261:93)\n at new _.C.HTMLElement (js?key=MY_API_KEY&v=3.exp&callback=initMap&libraries=places:338:225)\n at new HostElement (index-7a8b7a1c.js:1847:17)\n at DefaultDomRenderer2.createElement (platform-browser.js:645:1)\n at BaseAnimationRenderer.createElement (animations.js:249:1)\n at createElementNode (core.js:5759:1)\n at \xc9\xb5\xc9\xb5elementStart (core.js:14957:1)\n at AppComponent_Template (template.html:3:3)\n at executeTemplate (core.js:9705:1)\n at renderView (core.js:9508:1)\njs?key=MY_API_KEY&v=3.exp&callback=initMap&libraries=places:261 Uncaught TypeError: Failed to construct \'HTMLElement\': Please use the \'new\' operator, this DOM object constructor cannot be called as a function.\n at …Run Code Online (Sandbox Code Playgroud) ionic5 ×10
capacitor ×3
cordova ×3
angular ×1
angular11 ×1
angular12 ×1
firebase ×1
google-maps ×1
ionic-react ×1
ionic4 ×1
javascript ×1
modal-dialog ×1