我正在使用Swift上的IOS应用程序并将其连接到Firebase。在运行模式下到达特定页面后,我的应用程序崩溃,并且收到此错误消息,没有任何详细信息。请帮助
我的Outlets没有任何错误,我尝试使用断点进行调试,但是仍然带着错误(没有详细信息)将我带到AppDelegate。我无能为力。在它正常工作之前,代码应该可以正常工作,并且已经将数据输入到数据库中,但是自从我创建了登录页面以来,发生了一些事情。
<template>
<div class="chat container" v-if="isAuth">
<h2 class="text-primary text-center">Real-Time Chat</h2>
<h5 class="text-secondary text-center">Powered by Vue.js & Firebase</h5>
<div class="card">
<div class="card-body">
<p class="nomessages text-secondary" v-if="messages.length == 0">
[No messages yet!]
</p>
<div class="messages" v-chat-scroll="{always: false, smooth: true}">
<div v-for="message in messages" :key="message.id">
<span class="text-info">[{{ message.name }}]: </span>
<span>{{message.message}}</span>
<span class="text-secondary time">{{message.timestamp}}</span>
</div>
</div>
</div>
<div class="card-action">
<CreateMessage/>
</div>
</div>
</div>
</template>
<script>
import CreateMessage from '@/components/CreateMessage';
import firebase from '../components/firebaseconfig';
import AuthMonitor from '../AuthMonitor';
import moment from 'moment';
export default {
name: 'Chat',
mixins:[AuthMonitor],
components: {
CreateMessage
},
data() {
return{
messages: []
}
},
// created() {
// let ref = firebase.database().ref('messages');
// ref.onSnapshot(snapshot => {
// snapshot.docChanges().forEach(change => {
// if (change.type == 'added') {
// let doc = change.doc;
// this.messages.push({
// id: doc.id,
// name: doc.data().name,
// message: doc.data().message,
// timestamp: moment(doc.data().timestamp).format('LTS')
// });
// }
// });
// });
// }
}
</script>
<style>
.chat h2{
font-size: 2.6em;
margin-bottom: 0px;
}
.chat h5{
margin-top: 0px;
margin-bottom: 40px;
}
.chat span{
font-size: 1.2em;
}
.chat .time{
display: block;
font-size: 0.7em;
}
.messages{
max-height: 300px;
overflow: auto;
}
</style>
答案 0 :(得分:0)
这个问题我最终得到了解决,这个错误很简单。如果任何人都面临相同的问题,并且您确定自己的网点没有任何问题,请转到身份检查器并检查每个ViewController的类。确保不超过1个ViewController连接到同一类,尤其是在该类具有用于特定功能的代码的情况下。这就是我的应用程序崩溃并带我进入AppDelegate类的原因。崩溃前我到达的最后一页的代码没有错误,但是唯一的原因是将其连接到另一个ViewController使用的Class。