我正在关注HeadFirst Android开发中的教程并在添加后遇到问题:private ActionBarDrawerToggle drawerToggle;
该控件已弃用,因此我按照Stack上的说明通过将com.android.support:appcompat-v7:26.0.0-alpha1添加到应用程序模块依赖项来解决该问题
但现在我收到以下构建错误:
错误:任务':app:processDebugManifest'的执行失败.
清单合并失败:来自[com.android.support:recyclerview-v7:25.3.1]的属性meta-data#android.support.VERSION@value value =(25.3.1)AndroidManifest.xml:24:9-31也是出现在[com.android.support:appcompat-v7:26.0.0-alpha1] AndroidManifest.xml:27:9-38 value =(26.0.0-alpha1).建议:在AndroidManifest.xml:22:5-24:34中添加'tools:replace ="android:value"'来覆盖.
这是代码:
android gradle android-manifest android-support-library android-studio
我正在使用应用内购买,如果由于某种原因我无法从 Google 或 iOS 应用商店检索产品信息,我想将 UI 更改为“不可用”。
ionViewDidEnter() {
this.platform.ready().then(async () => {
firebase.auth().onAuthStateChanged(async user => {
this.currentUser = user;
});
this.unavailable = await this.setupProducts();
console.log('available', this.unavailable);
});
}Run Code Online (Sandbox Code Playgroud)
setupProducts(): Promise<boolean> {
let productWWHS: string;
let productISA: string;
if (this.platform.is('ios')) {
productWWHS = 'prodID';
productISA = 'prodID';
} else if (this.platform.is('android')) {
productWWHS = 'prodID';
productISA = 'prodID';
}
this.inAppPurchase.ready(() => {
this.products.push(this.inAppPurchase.get(productWWHS));
this.products.push(this.inAppPurchase.get(productISA));
if (!this.products[0]) {
return true;
}
});
return false;
}Run Code Online (Sandbox Code Playgroud)
我在这个方法中做错了,它有错误类型“boolean”不能分配给类型“Promise”
我想以某种方式断言 inAppPurchase.get() 已经返回了一些东西,但它没有返回承诺。
有一个更好的方法吗?
任何帮助,将不胜感激。
什么时候使用this.afAuth.auth.signInWithCredential在Ionic应用程序中一切正常。我可以使用Google身份验证登录,并且用户个人资料已推送到Firebase。但是,我在控制台中收到一个错误消息,已弃用signInWithCredential并使用signInAndRetrieveDataWithCredential。问题在于signInAndRetrieveDataWithCredential不提供任何用户数据(uid,用户电子邮件,显示名称)...全部为空。
那我该怎么办?控制台错误表明即使正在运行,也不要使用signInWithCredential。signInAndRetrieveDataWithCredential为用户返回null。
async googleLogin(): Promise<void> {
try {
const gplusUser = await this.gplus.login({
'webClientId': environment.googleWebClientId,
'offline': true,
'scopes': 'profile email'
});
return await this.afAuth.auth.signInWithCredential(
firebase.auth.GoogleAuthProvider.credential(gplusUser.idToken)
).then((credential) => {
console.log('creds', credential);
this.updateUserData(credential);
});
} catch (err) {
console.log(err);
}
}
private updateUserData(user) {
const userRef: firebase.firestore.DocumentReference = firebase.firestore().doc(`users/${user.uid}`);
const data: User = {
uid: user.uid,
email: user.email,
displayName: user.displayName,
};
console.log('user data', data);
return userRef.set(data);
}Run Code Online (Sandbox Code Playgroud)
firebase firebase-authentication angularfire2 angular ionic4
我创建了一个 Ionic Firebase 聊天应用程序。我认为我遇到的问题是我在消息页面初始化时设置了一个查询快照,如下所示:
ngOnInit() {
this.messageService.getAllMessages()
.doc(`${this.userId[0] + '-' + this.userId[1]}`)
.collection('message')
.orderBy('createdAt', 'asc')
.onSnapshot((doc) => {
this.messages = [];
doc.forEach((snap) => {
this.messages.push({
content: snap.data().content,
createdAt: snap.data().createdAt,
userId: snap.data().userId
});
});
console.log('messages', this.messages);
});
}Run Code Online (Sandbox Code Playgroud)
问题是,如果第一次尝试发送消息时没有消息,我第一次尝试访问该页面时不会加载该页面。
该消息有点模糊,但我很确定我遇到了这个问题,因为 Firebase 没有返回任何数据,但无法在查询中添加 .catch 来捕获错误并处理它,以便用户可以仍然导航到消息页面。
ERROR Error: Uncaught (in promise): Error: No value accessor for form control with unspecified name attribute
Error: No value accessor for form control with unspecified name attribute
at _throwError (vendor.js:70776)
at setUpControl (vendor.js:70646)
at NgModel._setUpStandalone (vendor.js:73693)
at …Run Code Online (Sandbox Code Playgroud)我正在构建一个聊天应用程序。当用户更新他们的本地配置文件时,我想使用云功能在集合组中进行更新。
我成功地收听了云函数中的更新,并使用以下内容检索了集合组列表:
const collectionGroupNameref = await db.collectionGroup('collectionGroupName').where('userId', '==', data.uid).get();
collectionGroupNameref.forEach(async (val: any) => {
const connectionsRef = await db.collection('collectionGroupName').doc(val.id).get();
});Run Code Online (Sandbox Code Playgroud)
但是现在我需要更新该 collectionGroup 中的一个字段,这就是我遇到问题的地方。
collectionGroup 存储在 2 个位置:
users{id}collectionGroupName{id}
groups{id}collectionGroupName{id}
Run Code Online (Sandbox Code Playgroud)
是否可以更新该集合组中的所有文档
<?xml version="1.0" encoding="UTF-8"?>
<plugin xmlns="http://www.phonegap.com/ns/plugins/1.0"
xmlns:android="http://schemas.android.com/apk/res/android"
id="cordova-plugin-telerik-imagepicker"
version="2.2.4">
<name>ImagePicker</name>
<description>
This plugin allows selection of multiple images from the camera roll / gallery in a phonegap app
</description>
<license>MIT</license>
<engines>
<engine name="cordova" version=">=3.5.0" />
</engines>
<js-module src="www/imagepicker.js" name="ImagePicker">
<clobbers target="plugins.imagePicker" />
</js-module>
<!-- ios -->
<platform name="ios">
<config-file target="config.xml" parent="/*">
<feature name="ImagePicker">
<param name="ios-package" value="SOSPicker"/>
</feature>
</config-file>
<preference name="PHOTO_LIBRARY_USAGE_DESCRIPTION" default=" " />
<config-file target="*-Info.plist" parent="NSPhotoLibraryUsageDescription">
<string>$PHOTO_LIBRARY_USAGE_DESCRIPTION</string>
</config-file>
<header-file src="src/ios/SOSPicker.h" />
<source-file src="src/ios/SOSPicker.m" />
<header-file src="src/ios/GMImagePicker/UIImage+fixOrientation.h" />
<source-file src="src/ios/GMImagePicker/UIImage+fixOrientation.m" />
<header-file …Run Code Online (Sandbox Code Playgroud)你如何在 Ionic 4 中设置背景图像?我尝试了几种方法都无济于事。
我正在关注本教程:https : //javebratt.com/ionic-firebase-tutorial-auth/
我也试过
--background: #fff url('../../assets/images/cover.jpg') 无重复中心/封面;}
任何帮助将不胜感激。我正在使用离子 4
ion-content {
.background{
background-image: url('../../../assets/img/login-image.jpg');
-webkit-background-size: cover;
-moz-background-size: cover;
background-size: cover;
}
form {
margin-bottom: 32px;
button {
margin-top: 20px !important;
}
}
p {
font-size: 0.8em;
color: #d2d2d2;
}
ion-label {
margin-left: 5px;
}
ion-input {
padding: 5px;
}
.invalid {
border-bottom: 1px solid #ff6153;
}
.error-message {
min-height: 2.2rem;
ion-label {
margin: 2px 0;
}
}
}Run Code Online (Sandbox Code Playgroud)
<ion-content class="background">
<form [formGroup]="loginForm">
<ion-item>
<ion-label …Run Code Online (Sandbox Code Playgroud)我遵循了两个建议安装以下内容的教程:
ionic cordova 插件添加 cordova-plugin-fcm-with-dependecy-updated npm install @ionic-native/fcm
安装到表示未安装 fcm 插件的设备后,我不断收到错误,因此我查看了建议卸载的https://www.npmjs.com/package/cordova-plugin-fcm-with-dependecy-updated#fcmontokenrefresh网站npm uninstall @ionic-native/fcm # 包含 Ionic 支持,但与 @ionic-native 的实现冲突。
所以我这样做并用这个代替:
import { FCM } from 'cordova-plugin-fcm-with-dependecy-updated';
getUserToken(userId: string) {
FCM.getToken().then(token => {
console.log('token');
console.log(token);
});
}
getToken(userId: string) {
FCM.onTokenRefresh((fcmToken: string) => {
console.log('token refresh');
console.log(fcmToken);
});
}Run Code Online (Sandbox Code Playgroud)
但现在我得到以下信息:
错误错误:未捕获(承诺中):TypeError:无法读取未定义的属性“onTokenRefresh”TypeError:无法读取未定义的属性“onTokenRefresh”
此时我被困住了。如果我使用 Ionic 插件,我会收到“未安装 FCMPluging”的信息,并且在使用 Cordova 库时会收到“无法读取未定义属性“onTokenRefresh”的错误信息。任何帮助将不胜感激。
{
"name": "",
"version": "0.0.1",
"author": "Ionic Framework",
"homepage": "https://ionicframework.com/",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng …Run Code Online (Sandbox Code Playgroud)cordova ionic-framework cordova-plugins firebase-cloud-messaging cordova-plugin-fcm
firebase ×3
ionic4 ×3
angular ×2
javascript ×2
typescript ×2
android ×1
angularfire2 ×1
async-await ×1
cordova ×1
css ×1
gradle ×1
html ×1
imagepicker ×1
node.js ×1
promise ×1