Xamarin.iOS: Firebase push notifications not working - c#

I am developing a Xamarin.Forms application with Xamarin.Android and Xamarin.iOS clients. For push notifications, I am using FirebasePushNotificationPlugin library. It works perfectly on Android, but not on iOS.
On iOS the app simply closes down after the request to use push notifications. So: the "Allow/Don't allow" popup is shown, and when the user clicks on Allow, the app closes down. No exception is thrown or anything.
I have done every step in the setup instructions, but just to double-check, I will show you screenshots of everything:
Firebase console: I have registered my iOS app on the Firebase console and inputted all required fields (App ID, Bundle ID, App Store ID, App ID Prefix). I have also uploaded the APNs Authentication Key (but no certificates).
NuGet: I have added Plugin.FirebasePushNotification package to both Xamarin.Forms and Xamarin.iOS projects.
GoogleService-Info.plist: I have added GoogleService-Info.plist (that I got from the Firebase console) to the Xamarin.iOS project and set its Build Action to BundleResource.
Info.plist: I have enabled remote notification background mode and added FirebaseAppDelegateProxyEnabled (and set it to No) in Info.plist.
Entitlements.plist: I have added production aps-environment entitlement.
It is production (and not development) because I cannot run and debug the app, so the app is actually being uploaded every time to the App Store Connect and tested with TestFlight as an internal tester.
Xamarin.iOS AppDelegate: I initialize the package in AppDelegate.FinishedLaunching method, right after LoadApplication(new App());. The false parameter means that it will not auto register for notifications (it will be registered later manually).
I also override methods RegisteredForRemoteNotifications, FailedToRegisterForRemoteNotifications, DidReceiveRemoteNotification and call respected methods (as stated in the Getting Started instructions).
Xamarin.Forms: Now this is when all goes to hell on iOS. When it calls CrossFirebasePushNotification.Current.RegisterForPushNotifications();, it shows the "Allow/Don't allow" popup, and after the user clicks "Allow", the app simply closes. No exception is thrown or anything (well, at least nothing gets caught in the try/catch statement). The app simply shuts down.
The interesting thing maybe is, that the FCM token is already (successfuly) created before all this and if I send a push message to that token (of that iOS app), the Firebase server returns success. So I'm guessing that the Firebase part is correct, but there is something wrong with the iOS and/or the library?
Any advice whatsoever will be greatly appreciated!

For anyone reading this: I have solved this problem by removing the FirebasePushNotificationPlugin library, which apparently doesn't work on iOS. I have then implemented the notifications using the Xamarin.Firebase.iOS.CloudMessaging package instead, following this GettingStarted guideline.

Related

UWP app crashes with STOWED_EXCEPTION shown in dev store

my UWP runs fine on my PC, I downloaded it from store to check it on my pc and it runs fine, but it is crashing on certain other PCs for unknown reasons, it crashed on the splash screen and dev center is showing me following crash reports.
Please let me know how can I fix or handle these exceptions.
NOTE
"Fluenttt" is the namespace of my app project.
Also note that dev center has no data in log for these exceptions. or no stacktrace shown.
ARM can't be the reason of your crash. ARM package is for mobile device and if you don't upload it when you publish your app, your app won't be available to customer on mobile device in Store.
Without your app, it's hard to tell the reason just according to your failure name. But you could add an UnhandledException event to notify your app about exceptions encountered by the XAML framework or by Windows Runtime in general that haven't been handled by your app code.
Additionally, you could also use Custom event to log the event or activity in your app and you can review the occurrences for your custom events in the Custom Events section of the Usage report in dashboard.

Windows 10 assigned access app fails to start due to not registered for Windows.Launch contract

I have a WPF application, which I have converted to a UWP application using the DesktopAppConverter for the purposes of running it in Assigned Access mode - the converted app works when run in non-assigned access mode - can be installed and functions properly.
However, when I set it up to be used as an assigned access application and log in with the account for assigned access, the screen keeps flashing (blue screen with loading dots, followed by a white screen, and repeat) for a period of time, resulting in the 0x80270254 error displayed.
Also after checking the Windows Event Logs I get two error messages in succession:
The application MyAppName is not registered for the Windows.Launch contract or is not installed.
ActivateApplicationForContractByAppIdAsUserWithHost of the app MyAppName for the Windows.Launch contract failed with This app does not support the contract specified or is not installed.
I've been trying to debug the app, including making changes to the AppxManifest.xml file and rebuilding the .appx package, making changes to the properties of the original WPF app that it came from and making changes to the Assigned Access user account's environment with little to no success.
Any tips for the resolution of the issue would be much appreciated.
Thank you for reporting this issue.
We got the confirmation that the Assigned Access mode doesn’t support Win32 apps yet, including Win32 apps converted with the Desktop Converter.
It is a known issue in RS1 which can pick Converted app in setting UI. We have a planned fix for this in RS2 but do not guarantee it will be delivered soon.
Please see this article for how to use Shell Launcher to config a kiosk device that runs a Classic Windows application as the user interface: https://technet.microsoft.com/en-us/itpro/windows/manage/set-up-a-kiosk-for-windows-10-for-desktop-editions

Xamarin - push notification - trigger for update data from server

Im new in mobile development. Now I write a little app.
User login in app
see list view of data from server. when I add something in server i send push to mobile and update data
Right now - i have Droid app that use this component(https://components.xamarin.com/view/gcmclient/) and receive messages
(c# console app for test ) -- all its work
Now question is - when i handle push from server - how to call method for update list view (this logic located in PCL and handle push located in droid app
P.S I still looking for good tutorial for iOS Push notification. Can somebody give me link?
P.S2 - if its possible use GCM for iOS?
You will need to call back into your PCL, either by Dependency Injection or some other method.
PS: GCM for iOS is here: https://components.xamarin.com/view/googleiosgcm

Xamarin.Mac - Issue submitting to Mac App Store

We are in the process of submitting our app for the Mac App Store. I get the following email from Apple when submitting to the store:
Dear developer,
We have discovered one or more issues with your recent delivery for "YourApp". To process your delivery, the following issues must be corrected:
App sandbox not enabled - The following executables must include the "com.apple.security.app-sandbox" entitlement with a Boolean value of true in the entitlements property list. Refer to the App Sandbox page for more information on sandboxing your app.
• YourApp.app/Contents/MacOS/YourApp
Once these issues have been corrected, go to the Version Details page and click "Ready to Upload Binary." Continue through the submission process until the app status is "Waiting for Upload." You can then deliver the corrected binary.
Under Project Options->Mac OS X Application, I have:
Enable Entitlements – checked
Some iCloud stuff auto-filled out
Enable App Sandboxing – checked
Allow outgoing network connections – checked
Under Mac OS X Packaging – I manually selected an App Store distribution certificate as well.
To submit, I’ve been using Build->Archive and submitting from inside XCode. If I “validate” inside XCode, there are no errors.
Any ideas?
Sent this issue to Xamarin Support, and they figured it out.
They send me a new version of Xamarin to install that fixed the issue.
Should be an update soon if other people have this issue.

Monotouch daemon application

Is there a way to create a daemon application for iOS, i'm not sure if daemons app are allowed in App Store, but Google Latitude does this in order to update user info when the application isn't loaded or in background.
Thanks.
iOS does not have services.
But you can setup your app to handle location updates when in the background. (But if a user force-quits the app from double-tapping home, your app will no longer receive these events)
I would review the iOS docs here, not sure if there is a MonoTouch example, but you should be able to translated what you would do in Objective-C.
I would not think it would be a trivial task, however.

Categories