【发布时间】:2019-04-15 13:54:15
【问题描述】:
我正在开发一个集成了 Firebase 身份验证的 Xamarin.Forms 应用。我已经为 Android 和 iOS 设置了依赖服务,以便在出现提示时创建新用户。 Android 依赖项工作正常,但每当我在我的 iOS 依赖项中调用任何“Auth”方法时,应用程序在启动时崩溃,并从我的委托文件中的“Firebase.Core.App.Configure()”行抛出以下错误:
Foundation.MonoTouchException 已被抛出
Objective-C 抛出异常。名称:NSInvalidArgumentException 原因: -[FIRApp setGetTokenImplementation:]:unrecognized selector sent to instance 0x282d3d1a0
...后面是一英里长的堆栈跟踪
我当前的 iOS 依赖代码如下:
using System;
using Xamarin.Forms;
using ActNearMe; //name of my app
using Firebase.Auth;
using Firebase.InstanceID;
using Firebase.Core;
using System.Collections.Specialized;
using System.Net;
using System.Threading.Tasks;
[assembly: Dependency(typeof(IFirebaseInterface))]
namespace ActNearMe.iOS
{
public class FirebaseInterface : IFirebaseInterface
{
WebClient client = new WebClient();
NameValueCollection sendingData;
public void CreateNewUser(string email, string password, NameValueCollection userData)
{
//sendingData = userData;
//Anytime I call anything with Auth here, the app won't even load.
Console.WriteLine(Auth.CurrentVersion);
//Auth.DefaultInstance.CreateUser(email, password,(authResult, error) => {
/*client.UploadValuesCompleted += (sender, e) =>
{
Console.WriteLine("it's done!");
};
client.UploadValuesAsync(new Uri("http://www.cvx4u.com/anm_web_services/create_user.php"), sendingData);
*/
//});
}
}
}
这是我的错误日志:
2019-04-15 10:18:53.724 ActNearMe.iOS[6964:1670900] +[FIRApp registerAsConfigurable:]: unrecognized selector sent to class 0x1060d1bb8
2019-04-15 10:18:53.724 ActNearMe.iOS[6964:1670900] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '+[FIRApp registerAsConfigurable:]: unrecognized selector sent to class 0x1060d1bb8'
*** First throw call stack:
(0x22401c518 0x2231f79f8 0x223f3e2c4 0x224021d60 0x2240239fc 0x2231f9ffc 0x2231fbe54 0x106626390 0x106638314 0x106637370 0x10663742c 0x1066266d8 0x10662b2a0 0x106625044)
libc++abi.dylib: terminating with uncaught exception of type NSException
Application 'com.russjowell.actnearme' terminated.
Launched application 'com.russjowell.actnearme' on 'iPhone (2)' with pid 6964
更新 所以我一直在尝试打开和关闭一些东西,省略某些代码行等。我还在我的应用程序中使用 Firebase Analytics,当我从我的 Xamarin.iOS 项目中删除 Firebase iOS NuGet Analytics 包时,一切正常,但是当你同时使用 Analytics 和 Auth 包时,崩溃会继续。所以我想我的新问题是: 是否可以在同一个项目中同时使用 Firebase iOS Auth 和 Firebase iOS Analytics?任何见解都会有所帮助。
【问题讨论】:
标签: firebase xamarin xamarin.ios firebase-authentication