Kebechet.Maui.RevenueCat.iOS
4.31.9-preview23
Prefix Reserved
See the version list below for details.
dotnet add package Kebechet.Maui.RevenueCat.iOS --version 4.31.9-preview23
NuGet\Install-Package Kebechet.Maui.RevenueCat.iOS -Version 4.31.9-preview23
<PackageReference Include="Kebechet.Maui.RevenueCat.iOS" Version="4.31.9-preview23" />
paket add Kebechet.Maui.RevenueCat.iOS --version 4.31.9-preview23
#r "nuget: Kebechet.Maui.RevenueCat.iOS, 4.31.9-preview23"
// Install Kebechet.Maui.RevenueCat.iOS as a Cake Addin #addin nuget:?package=Kebechet.Maui.RevenueCat.iOS&version=4.31.9-preview23&prerelease // Install Kebechet.Maui.RevenueCat.iOS as a Cake Tool #tool nuget:?package=Kebechet.Maui.RevenueCat.iOS&version=4.31.9-preview23&prerelease
Maui.RevenueCat.iOS
- this binding is based on: https://github.com/thisisthekap/Xamarin.RevenueCat.iOS
- it is created for .NET MAUI and targeted to
.NET 8
- it contains bindings for RevenueCat iOS plugin
Versioning Scheme
The versioning scheme of Maui.RevenueCat.iOS
is derived from the versioning of revenuecat/purchases-ios
.
Example:
revenuecat/purchases-ios | Maui.RevenueCat.iOS | Note |
---|---|---|
3.4.1 | 3.4.1.0 | First version of bindings for 3.4.1 |
3.4.1 | 3.4.1.17 | Bindings for 3.4.1 containing fixes |
Binding creation
Porting old xamarin library ios to .NET MAUI
First version of our Maui binding was just changed Xamarin.RevenueCat.iOS
binding working for .NET MAUI. It was binding around RevenueCat ios 4.9.0
, but this native library contained bitcode which is no longer accepted by AppStore.
Porting of binding from Xamarin to Maui required several changes:
- Removed some attributes in
ApiDefinitions
- commit - Changed
IntPtr
→NativeReference
inApiDefinitions
- commit - Added
NoBindingEmbedding = false
- commit
Creating completely new binding consisted of these steps:
Because of a problem with bitcode I have decided to create completely new binding from scratch. Here are steps I have done:
Generating binding files
- On my MAC I have downloaded and installed Objective Sharpie
- I have downloaded RevenueCat.framework.zip of
purchases-ios v4.19.0
- I have extracted the
iOS
folder on my MAC desktop - started terminal, then
cd ~/Desktop
- firstly check what versions of xcode SDKs you have installed by
sharpie xcode -sdks
and use theiphoneosXX.Y
version you have - I used command
sharpie bind -framework iOS/RevenueCat.framework -sdk iphoneos16.4 -scope iOS/RevenueCat.framework/Headers
- this command generated
ApiDefinitions.cs
andStructsAndEnums.cs
files - in case it did not and gives you error:
RevenueCat: framework requires SDK 'iphoneosXX.Y' which is not installed. You may need a newer Xcode.
In my case it wasiphoneos16.4
- if you have older Xcode then update it
- if you have newest Xcode then you need to install older iOS SDKs
- go to Apple developer web and download Xcode that contains that SDK. In my case
Xcode 14.3.1
containsiphoneos16.4
- after the download extract
.xip
file and after extraction right click on extracted Xcode file andShow Package Contents
- then navigate there into
/Applications/Xcode/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs
and copyiPhoneOsXX.Y.sdk
(if it is just link/alias then copy theiPhoneOs.sdk
and rename it toiPhoneOsXX.Y.sdk
in my caseiPhoneOS16.4.sdk
) - then go to location of your original Xcode →
Show Package Contents
→ navigate again to:/Applications/Xcode/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs
and paste the copiediPhoneOSXX.Y.sdk
there - restart Xcode
- to verify you did everything correctly run in terminal:
sharpie xcode -sdks
and the new SDK you copied should be now there as well - then run the
sharpie
command to generateApiDefinitions.cs
andStructsAndEnums.cs
files again
- go to Apple developer web and download Xcode that contains that SDK. In my case
- this command generated
Adjusting generated files
- then I placed new framework file into repo
- firstly commented but later completely removed
Verify
attributes - commit - then removed all device-specific attributes - commit
- TIP: You can find all attributes by searching for
iOS (
. Because all of them contain this string - at the same time commented out
(AutoGeneratedName = true)
- TIP: You can find all attributes by searching for
- added namespaces - commit
- comment out text that was not commented out - commit
- then I merged interfaces with the same names e.g.
RCAttribution
andRCAttribution_RevenueCat_Swift_3714
I put together - commit- I have also removed obsolete & deprecated interfaces/methods
- removed default using there were useless - commit
- removed constants interface - commit
- because I didnt know how to bind
byte[]
😅
- because I didnt know how to bind
- removed interfaces without methods/properties - commit
- remove Protocols that were used for inheritance - commit
- removed delegate that was not used anywhere - commit
- added
INativeObject
inheritance for interfaces that were used in dictionaries and was of typeNSObject
- commit - replaced
NSUrlRequest
forNSMutableUrlRequest
- commit - created delegates for Purchases - commit
- removed inherited
NSObject
methods - commitisEqual
andDescription
- also removed
DebugDescription
- commit
- removed inherited
NSOperation
methods - commit - I have created aliases for methods named the same - commit
- ⚠️ I dont know if this is correct or even necessary, maybe I could delete them as well
- removed attributes containing
Name
- commit- this was because on my windows machine I was getting errors that platform doesnt have symbols specified for this methods containing the name
- later I completely removed those methods because the error was still there - commit
- ✅ - Done
- I have tested this new binding in the simulator as well as on real device through TestFlight and it works as expected
⚠️Warning
- in .NET 7 and with VS2022 v17.7 IT IS NOT POSSIBLE TO BUILD THE PACKAGE WITH EMBEDDED NATIVE LIBRARY (even with connected MAC).
- You need to build this package on MAC with VS for MAC. Only that way it will link native library to the package.
- https://github.com/dotnet/maui/issues/14982
XCode
- beware that not always the newest version of Xcode is supported by
Maui
. E.g. currently isXcode v15.2
out butMaui
supports justv15.0
- to check currently supported
Xcode
forMaui
check this page. In the bindings section are supported versions.- Not always is the last one already supported. It can be
Work in progress
so take the 2nd last or checkxamarin-macios
issues if it is already done.
- Not always is the last one already supported. It can be
- to check currently supported
- if you already upgraded
Xcode
to version bigger than the one supported then uninstall it and download the last supported version from Apple developer web - after download extract
.xip
file and after extraction copyXcode
to/Applications
folder - open Xcode and then install all necessary components: https://i.imgur.com/zfRqIzy.png
- if you cant connect to your mac because of error:
The connection cannot continue because the remote iOS SDK was not found or is corrupted.
then on your mac run:rm -rf ~/Library/Caches/Xamarin/XMA/SDKs/dotnet
License
This repository is licensed with the MIT license.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0-ios17.2 is compatible. |
-
net8.0-ios17.2
- No dependencies.
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Kebechet.Maui.RevenueCat.iOS:
Package | Downloads |
---|---|
Kebechet.Maui.RevenueCat.InAppBilling
Serves as an abstraction around RevenueCat Android and iOS SDKs https://docs.revenuecat.com/docs |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
4.31.9.3 | 527 | 9/30/2024 |
4.31.9.2 | 144 | 8/7/2024 |
4.31.9.1 | 1,992 | 1/18/2024 |
4.31.9.1-preview1 | 90 | 1/18/2024 |
4.31.9 | 115 | 1/17/2024 |
4.31.9-preview31 | 91 | 1/17/2024 |
4.31.9-preview30 | 91 | 1/17/2024 |
4.31.9-preview23 | 94 | 1/17/2024 |
4.31.9-preview22 | 96 | 1/17/2024 |
4.31.9-preview21 | 96 | 1/17/2024 |
4.31.9-preview1 | 97 | 1/17/2024 |
4.19.0.3 | 167 | 7/31/2023 |
4.19.0.2 | 137 | 7/31/2023 |
4.19.0.1 | 162 | 7/31/2023 |
4.19.0 | 1,076 | 7/21/2023 |
4.19.0-preview3 | 313 | 5/17/2023 |
4.19.0-preview2 | 132 | 5/17/2023 |
4.19.0-preview1 | 141 | 5/17/2023 |
4.9.0.2-fix8 | 176 | 5/17/2023 |
4.9.0.2-fix7 | 170 | 5/10/2023 |
4.9.0.2-fix5 | 124 | 5/7/2023 |
4.9.0.2-fix4 | 137 | 5/7/2023 |
4.9.0.2-fix3 | 129 | 5/7/2023 |
4.9.0.2-fix1 | 143 | 5/7/2023 |
4.9.0.2-fix0 | 132 | 5/6/2023 |
Upgrade to .NET8