question

Minseo avatar image
Minseo asked

PCL SDK for Xamarin,PCL SDK for Xamarin Forms

Looking for PlayFab SDK that can be used in Xamarin Forms PCL project.

https://api.playfab.com/docs/getting-started/xamarin-getting-started-guide

Example on the above link is based on Shared project and can not be used on PCL project.

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1807605288 avatar image
1807605288 answered

This sounds like a feature request, and I'm happy to add it to our backlog, but I'm going to need more details about what exactly you need, and how to set up the project you want.

If I interpret your request correctly, you're looking for a PlayFab plugin which can be integrated into a pre-compiled library for a Xamarin project. Would this come in the form of a NuGet package? If not, what is the delivery method?

If your request IS just a NuGet package, then can you test the PlayFab CSharp nuget package with your Xamarin project? It may already work.

Upto now, I haven't had any specific requests for Xamarin, and I'm not familiar at all with Xamarin in general, so I built a project that compiled and executed some basic calls successfully. Please be as specific as you can in your request, so I can build it the right way.

Thanks!

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Minseo avatar image
Minseo answered

There is two types of Xamarin.Forms project that can be made in Visual Studio, one is 'Shared Project' and the other is 'Portable Class Library'.

https://developer.xamarin.com/guides/cross-platform/application_fundamentals/code-sharing/

https://developer.xamarin.com/guides/cross-platform/application_fundamentals/pcl/introduction_to_portable_class_libraries/

The point is that only a subset of the .NET framework is available to use on PCL project.


Errors above occur when 'CSharpSDK-versioned\PlayFabClientSDK\source' is added to Forms PCL project. I merely guess these errors are from incompatibility on class reference between .NET framework and a subset of it. Adding SDKs to each native client project was not successful too.

I actually managed to send some API calls via native client project though.

There WAS a NuGet package called PlayFabAllSDK and worked as expected on native client project not on Forms project.

https://www.nuget.org/packages/PlayFabAllSDK/

From that, based on MVVM model, I had to make this program communicate between the code from Forms project and the code from native project. This is a kind of workaround but MessagingCenter was the answer. I had to create some event based Subscription-Sender relationship and all client APIs worked fine.

My suggestion is here.

Build NuGet PlayFabSDK based on Portable Class Library.

or

Add instruction for Xamarin.Forms PCL project on behalf of beginner at following doc.

https://api.playfab.com/docs/getting-started/xamarin-getting-started-guide

Some major benefits for using PCL here..

  1. PCL is good choices for building sharable code libraries especially publishing on NuGet
  2. Allows you to share code across multiple projects.
  3. A good solution if you plan to share the resulting assembly with other developers.

hundreds of plugins for PCL project exist.

https://github.com/xamarin/XamarinComponents

Thank you.


debug24663.png (73.0 KiB)
1 comment
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1807605288 avatar image 1807605288 ♦ commented ·

This is super helpful, thanks! I'll put this in the backlog. I don't think we can get to it right away, but I agree on the value.

Thanks!

0 Likes 0 ·
Minseo avatar image
Minseo answered

Changed the profile to 111, all problems solved.

'.NETPortable,Version=v4.5,Profile=Profile259'

to

'.NETPortable,Version=v4.5,Profile=Profile111'

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.