How to get a Xamarin iOS notification service extension working? - xamarin

I'm trying to add a notification service extension to my Xamarin iOS so that I can receive silent notifications. I'm using OneSignal and have followed their instructions and set up everything that I think is required:
App bundle id = com.abc.abcapp
Extension bundle ID = com.abc.abcapp.OneSignalNotificationServiceExtension
Added extension project reference to app
Enabled App Groups in app & extension and set to group.com.abc.abcapp.onesignal (also registered this in Apple developer portal)
Using Automatic Provisioning for both, which seems to have registered everything properly
It builds fine. I have Visual Studio 2022 deploy it to a physical iPhone plugged into my computer. It deploys fine. But notifications don't appear to go to the extension. They just go to the App, which limit the number of silent notifications I can send to a device to a few an hour.
Some possibly useful debugging?
Getting the phone's device log in Visual Studio is really hit or miss but at one point I did see this err:
Library Validation failed: Rejecting '/private/var/containers/Bundle/Application/11D98889-9C2C-4218-A2C8-227C93CBD579/Abc.app/PlugIns/OneSignalNotificationServiceExtension.appex/libOneSignalNotificationServiceExtension.dll.dylib' (Team ID: none, platform: no) for process 'OneSignalNotific(2868)' (Team ID: CJTV38PNRD, platform: no), reason: mapped file has no cdhash, completely unsigned? Code has to be at least ad-hoc signed.
When I try to build this in MS App Center, it doesn't recognize that I have an extension and doesn't let me associate a second profile or cert. (which I think it's supposed to do?)

According to documentation You can’t modify silent notifications or those that only play a sound or badge the app’s icon.

Related

How to enable phone auth firebase, flutter, xcode

I have Flutter Firebase auth configured and it is working perfectly with Android. But with ios, I cannot seem to get it to work.
Am using Xcode and Flutter on MacOS deploying to a physical iphone()14.4) and I have followed the instructions:
Added googleservice-info.plist into project via Xcode.
Under Signing and capabilities in Xcode, Provisioning profile, Team , Bundle identifier, Signing certificate(Apple Development certificate) configured with no errors. Push Notifications(Release) also enabled.
In developer.apple.com, under Identities->myapp, I have enabled Push Notifications. I have also created development and production SSL certs inside Push Notifications. Also created key for Apple Push Notifications service (APNs).
In my Firebase project, I have added iOS apps and all the fields are populated. Under Cloud Messaging, in iOS apps, I have uploaded the APN key and both development and Production certs I got from Apple Developer.
I run 'flutter run --release' (I am using a physical iphone(14.4)) because debug mode is not allowed on 14.4. App installs successfully. I am able to navigate pages and even register email/pw with Firebase. But when I do a Firebase phone auth (verifyPhoneNumber), I keep getting an error as indicated by a snackbar error I coded in. Problem is that I cannot get the specific error from the logs since I have deployed using release and flutter logs remain blank.
I don't know what else to do. Please help.
Figured it out. Problem was with URL Types under Info of target Runner. Had to add URL Scheme. For those who has this problem, refer to the below.
https://firebase.google.com/docs/auth/ios/phone-auth
iOS uses captcha with Firebase.

Xamarin.iOS on macincloud development and automatic provisioning setup

I'm trying to develop a cross-platform app using xamarin forms and mac-in-cloud. Specifically with ios, I'm trying to set-up automatic provisioning since I originally got the error when debugging: >Could not find any available provisioning profile for (app name).iOS on iOS
So, after researching into the issue I put my apple developer acct info in, and when trying to use automatic provisioning. I get an error under Team: >There were errors in the data supplied. Please correct and re-submit. There are no current IOS devices on this team matching the provided device IDs.
Now, following the research rabbit hole, I go to the apple developer portal, try and register device, select macOS, insert Hardware UUID of mac mini into device ID, so on. And no change to error(s).
Question time, am I setting it up completely wrong? Other (older) articles/forums suggest linking an ios device via itunes, however, that seems counterproductive to my objective. Anyways, any help would be greatly appreciated. Apologies for any naiveté.
What are you trying to develop with the mac? Is it a iOS (iPhone) app? If so you can just use the simulator on the mac, and the mac does not need to be registered.
Try manual provisioning in VS
Signing Identity > Development (your name)
Provisioning profile > probably will be vs (something)
Also in VS go to Preferences > Apple Developer Accounts > make sure your account is listed. Then on the right hand side, click 'View Details' then 'Download all profiles'
Restarting VS or the mac may also help.

Xcode Team is not enrolled in the Apple Developer Program

I'm developing my personal mobile application.
I've used react native to build the application, and I'm now trying to bring my application on my iPhone X, using Xcode, however, when I'm trying to deploy the application I've got the following error:
Team [My Team Name] is not enrolled in the Apple Developer Program.
Is enrolling mandatory even for testing on personal devices?
Thanks!
What I did is listed below:
Created a Development certificate
Couldn't create a Distribution certificate ("Your account does not have permission to create iOS Distribution certificates")
Build the project correctly
Set signing of the project (both application and testing) to my Development certificate
Set scheme to my personal iPhone X
Click on "Distribute App"
Try on both, "Ad hoc" and "Development"
The only answer I've got is the error shown above.
Many thanks shim, I didn't have all those options since I'm using Xcode 10, however playing around with the signature settings I've made it out.
For whom other that will struggle with this issue, basically there's no point to archive the project to deploy on the Device.
The solution was just to select my device in the within the Schemas and just Run it on the device, that actually install the app on the mobile device.

How to upload to Apple's My Apps from a Xamarin project

I specifically need help getting the app build into my apps. I am so new to the MAC ecosystem. I need to get my app build from my windows 10 box (parallels) running VS2017/Xamarin Forms project uploaded to My Apps. What i have found is helpful if you are using xcode on the mac.
I have read tons of pages and help files and with all of that what I have includes:
created an app in VS2017/Xamarin that runs happily on the emulator from the MAC (MacBook Pro)
purchased the app dev subcription from apple
created a Production certificate (I don't need this yet but I was in there so...)
created a Development certificate
created a key pair from the Dev cert (that show up in the keychain)
created an App Group
created my app's placeholder under My Apps on App Store Connect
added my iPhone to devices via connecting to the Mac getting the UDID from iTunes
created a development provisioning profile for my iPhone (Not sure how this helps my testflight plight)
Assumptions
You must submit for review the same way for both TestFlight and Prod release to the actual store.
You don't need to open the app in xcode outside Xamarin
There is a tool or concept I am missing out on.
For development outside of Xcode, you will want to use Apple's Application Loader App to upload your app to App Store Connect.
As I said in comment to Matt below his correct answer to my actual question above, I needed to get the project right to get to that point.
Here are the more intimate details for the lurkers. I hope this helps some of you.
I was getting, or trying, to get all of this in place manually instead of letting VS do it's work getting this stuff together while I got to coding. FastLane FTW
Open the account management window, go to Tools > Options > Xamarin > Apple Accounts
Add your AppleID
Click on your appleID
Click the add button
Select your id in the lower text area
then add your distro cert. As is proper you deploy to TestFlight as a prod release.
Then get over to to your iOS project properties:
Make sure that your project is outputting an IPA. (Not Beer ;) )
These are my settings that worked. There could be other configurations that work as well.
I never get the automatic provisioning to work. And while this bundle signing settings look like it will not work, it does. I have received my apple approval for beta and users are in testflight.
Also, make sure you update the version of the app in the plist for subsequent releases. This change is not carried through from the AssemblyInfo.cs as one might expect. viola.
If you see this during debug make sure your debug version has Developer (Automatic) set for your debug settings.
FWIW - My VS2017:
While this does not perfectly match the info # https://learn.microsoft.com/en-us/xamarin/cross-platform/macios/apple-account-management?tabs=windows it worked for me. That page was key to the solution and deserves citing. Your mileage may vary.
If I missed something please reach out and I will update this.

signed electron app shell.openItem() fails

I want my Electron app could open *.txt-files (generated by my app) with system default application (default text editor).
I use shell.openItem(path) to perform it - and it worked fine... until I've packed (mas) and signed the app. I suppose I have to add some entitlements when signing, but already tried bunch of them without success :(
Could anyone give me a hand with that?
Unfortunately Electron disables the shell.openItem() API in Mac App Store builds. From their signing guide:
[shell.openItem()] will fail when the app is signed for distribution in the Mac App Store. Subscribe to #9005 for updates.
However, there is a work-around that will enable you to have the same functionality:
shell.openExternal('file://' + myFilePath);
This approach is also confirmed to pass the Apple Store Reviews (see here).

Resources