Comments (29)
@Ghevi I am running it from windows pc. Dont have a mac I am afraid :( . It works fine in simulator.
if it was a .plist issue why would it work in simulator. Any more suggestions would be highly appreciated.
from plugin.firebase.
I have the
GoogleService-Info.plist
in the root folder of the project (maybe it can go in the platforms/ios one?)
Here is how I do it:
<BundleResource Include="Platforms\iOS\GoogleService-Info.plist" Link="GoogleService-Info.plist" />
from plugin.firebase.
Same. Appears the launchOptions are always null.
from plugin.firebase.
I have the same problem.
Is there any fix yet?
from plugin.firebase.
If anyone could provide a sample project that contains this issue I will take a look, thanks✌️
from plugin.firebase.
This is a simple sample project, i tested it and have the same issue.
(i deleted the GoogleService-Info.plist)
from plugin.firebase.
Thanks @Shalafi280438, but unfortunately I'm not able to install your project onto my iOS simulator with the following error:
/Library/Frameworks/Xamarin.iOS.framework/Versions/Current/bin/mlaunch --launchsim /Users/tobiasbuchholz/Downloads/MAUIiOS/MAUIiOS/bin/Debug/net6.0-ios/iossimulator-x64/MAUIiOS.app --device=:v2:udid=B069F1E3-DBE7-4296-9C8E-A184C4F5B913 -sdk 15.4 --argument=-monodevelop-port --argument=10000 --setenv=XAMARIN_DEBUG_PORT=10000 --sdkroot /Applications/Xcode.app/Contents/Developer
An error was encountered processing the command (domain=IXUserPresentableErrorDomain, code=4):
„MAUIiOS“ muss aktualisiert werden.
Diese App muss vom Entwickler aktualisiert werden, um mit dieser iOS-Version zu funktionieren.
Failed to find matching arch for input file: /Users/tobiasbuchholz/Library/Developer/CoreSimulator/Devices/B069F1E3-DBE7-4296-9C8E-A184C4F5B913/data/Library/Caches/com.apple.mobile.installd.staging/temp.zijBk1/extracted/MAUIiOS.app/MAUIiOS
Underlying error (domain=MIInstallerErrorDomain, code=15):
Failed to find matching arch for input file: /Users/tobiasbuchholz/Library/Developer/CoreSimulator/Devices/B069F1E3-DBE7-4296-9C8E-A184C4F5B913/data/Library/Caches/com.apple.mobile.installd.staging/temp.zijBk1/extracted/MAUIiOS.app/MAUIiOS
error HE0046: Failed to install the app 'com.allinklcom.mauiios' on the device 'iOS 15.4 (19E240) - iPhone 13': simctl returned exit code 4
The error occurs with Visual Studio for Mac and also with Rider. Any idea what could cause this?
@tegrityllc Apparently the launchOptions are always null and don't cause any problems, at least that's the case for my projects. I've noticed in the .csproj file of @Shalafi280438's project that the GoogleService-Info.plist
is located in Platforms\iOS\GoogleService-Info.plist
. As far as I've tried it, this won't work, so you'll have to put the GoogleService-Info.plist
in the root folder of the application like I've mentioned in the README. Maybe that's the problem?
from plugin.firebase.
Maybe you can't install the project because it is created with the new Preview-version of Visual Studio?
I always read that the plist must be placed in the Platforms Folder, but i will try next week when i'm in office again ;)
from plugin.firebase.
It still doesn't work.
I tried to use Firebase on an Xamarin.Forms App with the Plugin.FirebasePushNotification Package, but on iOS i got nearly the same error.
Is it normal that i got several errors while starting the app?
`2022-10-05 14:45:33.558 Xamarin.PreBuilt.iOS[1108:205729] Could not resolve assembly Microsoft.VisualStudio.DesignTools.TapContract, Version=17.0.0.0, Culture=neutral, PublicKeyToken=null. Details: Could not load file or assembly '/var/mobile/Containers/Data/Application/C3D0D3F9-2A14-459F-9967-2B393CF3D511/Documents/AIMessenger.content/Microsoft.VisualStudio.DesignTools.TapContract.dll' or one of its dependencies.
2022-10-05 14:45:33.562 Xamarin.PreBuilt.iOS[1108:205729] Could not resolve assembly Xamarin.HotReload.Contracts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null. Details: Could not load file or assembly '/var/mobile/Containers/Data/Application/C3D0D3F9-2A14-459F-9967-2B393CF3D511/Documents/AIMessenger.content/Xamarin.HotReload.Contracts.dll' or one of its dependencies.
Resolved pending breakpoint for 'Xamarin.HotReload.HotReloadAgent.BreakpointSendToIde(System.String)' to D:\a_work\1\s\HotReload\Source\Xamarin.HotReload.Agent\HotReloadAgent.cs:419 [0x00000].
2022-10-05 14:45:33.823 Xamarin.PreBuilt.iOS[1108:205729] Could not resolve assembly Xamarin.HotReload.Contracts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null. Details: Could not load file or assembly '/var/mobile/Containers/Data/Application/C3D0D3F9-2A14-459F-9967-2B393CF3D511/Documents/AIMessenger.content/Xamarin.HotReload.Contracts.dll' or one of its dependencies.
2022-10-05 14:45:33.824 Xamarin.PreBuilt.iOS[1108:205729] Could not resolve assembly Microsoft.VisualStudio.DesignTools.TapContract, Version=17.0.0.0, Culture=neutral, PublicKeyToken=null. Details: Could not load file or assembly '/var/mobile/Containers/Data/Application/C3D0D3F9-2A14-459F-9967-2B393CF3D511/Documents/AIMessenger.content/Microsoft.VisualStudio.DesignTools.TapContract.dll' or one of its dependencies.
Resolved pending breakpoint for 'Xamarin.HotReload.HotReloadAgent.BreakpointCheckpoint()' to D:\a_work\1\s\HotReload\Source\Xamarin.HotReload.Agent\HotReloadAgent.cs:414 [0x00000].`
from plugin.firebase.
I believe the problem is that Firebase app itself is not getting initialized. I've tried to run the sample initializing the cloud messaging only (new CrossFirebaseSettings(isCloudMessagingEnabled: true)
). Doing so throws the following exception:
[0:] An error occurred: 'Object reference not set to an instance of an object.'. Callstack: ' at Plugin.Firebase.CloudMessaging.FirebaseCloudMessagingImplementation.RegisterForRemoteNotifications() in C:\Source\Plugin.Firebase\src\iOS\CloudMessaging\FirebaseCloudMessagingImplementation.cs:line 29
at Plugin.Firebase.CloudMessaging.FirebaseCloudMessagingImplementation.Initialize() in C:\Source\Plugin.Firebase\src\iOS\CloudMessaging\FirebaseCloudMessagingImplementation.cs:line 21
at Plugin.Firebase.iOS.CrossFirebase.Initialize(UIApplication app, NSDictionary options, CrossFirebaseSettings settings, Options firebaseOptions, String name) in C:\Source\Plugin.Firebase\src\iOS\CrossFirebase.cs:line 38
at Playground.MauiProgram.<>c.<RegisterFirebaseServices>b__2_8(UIApplication app, NSDictionary launchOptions) in C:\Source\Plugin.Firebase\sample\Playground\MauiProgram.cs:line 70
at Microsoft.Maui.MauiUIApplicationDelegate.<>c__DisplayClass6_0.<FinishedLaunching>b__0(FinishedLaunching del)
at Microsoft.Maui.LifecycleEvents.LifecycleEventServiceExtensions.InvokeLifecycleEvents[FinishedLaunching](IServiceProvider services, Action`1 action)
at Microsoft.Maui.MauiUIApplicationDelegate.FinishedLaunching(UIApplication application, NSDictionary launchOptions)
at UIKit.UIApplication.Main(String[] args, Type principalClass, Type delegateClass)
at Playground.Program.Main(String[] args) in C:\Source\Plugin.Firebase\sample\Playground\Platforms\iOS\Program.cs:line 12
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)'
If the Firebase app is not initialized properly (calling the Firebase.Core.App.Configure
method) then the following Messaging.SharedInstance
reference will throw NRE:
I think the problem is with the underlying Xamarin.Firebase.iOS.Core nuget itself as reported here:
xamarin/GoogleApisForiOSComponents#577
from plugin.firebase.
So is there a workaround or something to get it working?
from plugin.firebase.
from plugin.firebase.
Hi I also experience the same issue. I'm trying to deploy the app to a phisical device.
This exception happens both on windows machine and mac.
Another example of how to implement push notifications on ios is this one but in the readme it says that this only works on release.
It's the first time I implement push notifications on iOS, do you guys have any suggestion for doing it without any package?
I tried implementing it natively but it seems the necessary methods aren't called at all.
from plugin.firebase.
Ok so after some tries with the link i provided in the comment above, i managed to make notifications works on iOS device even in debug.
The firebase options initialization throws exception on Windows machine but it works on Mac!
The package Xamarin.Firebase.iOS.CloudMessaging
that it's used in that repo for some reason gave me some missing resource error.
So i'm still using the Plugin.Firebase
package as of this repo but I'm following the code example i mentioned above.
from plugin.firebase.
Any workaround on this issue? can you please let me know?
from plugin.firebase.
I'm still getting error using macOS: Terminating app due to uncaught exception 'System.NullReferenceException', reason: 'Object reference not set to an instance of an object. (System.NullReferenceException)
at Plugin.Firebase.Auth.FirebaseAuthImplementation.Initialize
Anyone how to fix this issue? please help
from plugin.firebase.
anyone knows how to fix this issue???please help!
from plugin.firebase.
Hi @elprofesor0710, what do you mean by:
I'm still getting error using macOS: ...
Are you targetting macOS or do you mean that you are running the project on a mac? Targetting macOS is not supported by the plugin.
Did you put the GoogleServices-Info.plist
and google-services.json
files in the project root and referenced them correctly in your .csproj
file as described in the readme? Or can you provide a sample project that showcases the problem?
from plugin.firebase.
@elprofesor0710 @Ghevi @balazs-adam @Shalafi280438 Facing same issue while running the MAUI App on ios Device.
Crashes at CrossFirebase.Initialize(app, launchOptions, CreateCrossFirebaseSettings()); with NULL Reference Exception.
Anyone got workaround? Urgent
from plugin.firebase.
@priyarishi Are you launching the app from a windows pc? Try on mac and if the issue persist it something about the GoogleServices-Info.plist
i think. I remember having that error but i forgot what was the issue :(
Sorry removed the code snippet cause i found an unrelated bug lol
from plugin.firebase.
@Ghevi Can you by any chance share the ios Specific code you had in the events. Did you try running this on a physical device?
from plugin.firebase.
Sorry if this is kind of a mess, im still new to mobile development anyway yes this code work on physical device and the app has been accepted to the appStore.
Tips are welcome ;)
using Firebase.CloudMessaging;
using Foundation;
using UIKit;
using UserNotifications;
namespace MyApp;
[Register("AppDelegate")]
public class AppDelegate : MauiUIApplicationDelegate,
IAppDelegate,
IUNUserNotificationCenterDelegate,
IMessagingDelegate
{
protected override MauiApp CreateMauiApp()
{
return MauiProgram.CreateMauiApp();
}
public override Boolean FinishedLaunching(UIApplication application, NSDictionary launchOptions)
{
var result = base.FinishedLaunching(application, launchOptions);
var authOptions = UNAuthorizationOptions.Alert | UNAuthorizationOptions.Badge | UNAuthorizationOptions.Sound;
UNUserNotificationCenter.Current.RequestAuthorization(authOptions, (granted, error) =>
{
Log($"RequestAuthorization: {granted}" + (error != null ? $" with error: {error.LocalizedDescription}" : string.Empty));
if (granted && error == null)
{
this.InvokeOnMainThread(() =>
{
UIApplication.SharedApplication.RegisterForRemoteNotifications();
try
{
var options = new Firebase.Core.Options(
"your googleAppId",
"your gmcSenderId");
options.ApiKey = "your api key";
options.ProjectId = "your project id";
options.BundleId = "your bundle id";
options.ClientId = "your client id";
Firebase.Core.App.Configure(options);
}
catch (Exception x)
{
Log("Firebase-configure Exception: " + x.Message);
}
UNUserNotificationCenter.Current.Delegate = this;
if (Messaging.SharedInstance != null)
{
Messaging.SharedInstance.Delegate = this;
Log("Messaging.SharedInstance SET");
}
else
{
Log("Messaging.SharedInstance IS NULL");
}
});
}
});
return result;
}
[Export("application:didFailToRegisterForRemoteNotificationsWithError:")]
public void FailedToRegisterForRemoteNotifications(UIApplication application, NSError error)
{
Log($"{nameof(FailedToRegisterForRemoteNotifications)}: {error?.LocalizedDescription}");
}
[Export("messaging:didReceiveRegistrationToken:")]
public void DidReceiveRegistrationToken(Messaging messaging, String fcmToken)
{
Log($"{nameof(DidReceiveRegistrationToken)} - Firebase token: {fcmToken}");
}
[Export("userNotificationCenter:willPresentNotification:withCompletionHandler:")]
public void WillPresentNotification(UNUserNotificationCenter center, UNNotification notification, Action<UNNotificationPresentationOptions> completionHandler)
{
var userInfo = notification.Request.Content.UserInfo;
Log($"{nameof(WillPresentNotification)}: " + userInfo);
MessagingCenter.Send(this, nameof(WillPresentNotification), userInfo);
completionHandler(UNNotificationPresentationOptions.Alert);
}
[Export("userNotificationCenter:didReceiveNotificationResponse:withCompletionHandler:")]
public void DidReceiveNotificationResponse(UNUserNotificationCenter center, UNNotificationResponse response, Action completionHandler)
{
Log($"{nameof(DidReceiveNotificationResponse)}: " + response.Notification.Request.Content.UserInfo);
MessagingCenter.Send(this, nameof(DidReceiveNotificationResponse), response.Notification.Request.Content.UserInfo);
completionHandler();
}
static void Log(String msg)
{
System.Diagnostics.Debug.WriteLine(msg);
}
}
from plugin.firebase.
@Ghevi Still facing the same issue.
[0:] An error occurred: 'Object reference not set to an instance of an object.'. Callstack: ' at Plugin.Firebase.Auth.FirebaseAuthImplementation.Initialize(UIApplication application, NSDictionary launchOptions, String facebookAppId, String facebookDisplayName)
at Plugin.Firebase.iOS.CrossFirebase.Initialize(UIApplication app, NSDictionary options, CrossFirebaseSettings settings, Options firebaseOptions, String name)
from plugin.firebase.
@elprofesor0710 Were you able to resolve the issue. Can you please give some details. I am getting the error on ios device and simulator works fine.
from plugin.firebase.
@priyarishi I tried again today and from a windows pc with iPhone device, the code i gave you works except for when it tries to create the Firebase Options, which is different from your issue.
I have the GoogleService-Info.plist
in the root folder of the project (maybe it can go in the platforms/ios one?) and in .csproj
i have this code:
<ItemGroup>
<PackageReference Include="Plugin.Firebase" Version="1.2.1" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'net6.0-ios'">
<BundleResource Include="GoogleService-Info.plist" />
</ItemGroup>
from plugin.firebase.
@Ghevi @tranb3r Thanks so much for responding. I have tried to move the GoogleService-Info.plist the way you specified and also the bundleresource tag . But the same issue happens.
My Plugin.Firebase version is 1.2.5 (latest one). I revered it to the version you have 1.2.1. But the same issue.
I have attached my sample project . If you guys could check what am I missing and if it works on your end. I have removed the GoogleService Info files for now. Please let me know if thats fine.
You will see some commented code in the AppDelegate.cs file. I have tried the commented code as well. Same error occurs.
Would be great if you could use this project to run on your device. This will run with just one button on MainPage.xaml which calls the Google SSO.
I need to use this Plugin just to login using Google and nothing else ( no messaging or notifications are needed for the project).
Thanks
SSOMAUI.zip
from plugin.firebase.
@priyarishi ah dang im sorry, i thought you were using it for the cloud messaging. My bad. Hopefully someone else can helo you. I have no experience with the google authentication.
from plugin.firebase.
@Ghevi No Problem. I should have clarified this before I guess. But according to me the Firebase Auth initialization happens in all the cases. if its for the sso or messaging.
from plugin.firebase.
Since I haven't heard from you in more than 30 days, I hope this issue is no longer affecting you. If it is, please reopen this issue and provide the more information so that I can look into it further. Thank you!
from plugin.firebase.
Related Issues (20)
- FirebaseAnalytics null exception on Android .NET8 HOT 9
- Firestore, issue when reading an Integer Dictionary field HOT 1
- Plugin not building with Visual Studio 17.10.4 HOT 5
- Show an image on iOS notifications HOT 2
- Error : clang++ exited with code 1 on Maui .Net8 HOT 1
- null
- Persistent Invalid Cloud Messaging Token Returned on iOS HOT 4
- Build Process Hanging at File Extraction GAppM-10.24.0.tgz HOT 2
- Crash when use different plist file
- Enable smartphone vibrate on Android on fcm retrieval
- FCM update 2.0.4 -> 3.0.0
- Error loading partial Info.plist template file on version 3.0.0
- Plugin.Firebase is not available in .net8-ios HOT 1
- Firebase.Crashlytics: Java.Lang.IllegalStateException + System.Reflection.TargetInvocationException HOT 1
- Enabling and Disabling Firebase Performance Monitoring
- CloudMessaging Android notification sound HOT 1
- Exception - Couldn't retrieve FCM token HOT 2
- Making push notifications work after device reboot when using Plugin.Firebase HOT 4
- Token generated on iOS is similar to Android token. Cannot received push notification. HOT 3
- [Installation Issue]: Firebase.Analytics, Privacy Policy not found in .NET 8.0 Maui Project HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from plugin.firebase.