Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[v2.0.0-develop-1][Xamarin] User SignUp #353

Open
P0wmes opened this issue May 22, 2021 · 4 comments
Open

[v2.0.0-develop-1][Xamarin] User SignUp #353

P0wmes opened this issue May 22, 2021 · 4 comments
Labels

Comments

@P0wmes
Copy link

P0wmes commented May 22, 2021

i was using parse sdk v2.0 in a Xamarin Forms Shared Project.
I am trying to register a new user using Source: https://github.com/parse-community/Parse-SDK-dotNET/#basic-demonstration

Steps to reproduce

Create a Xamarin Forms Shared Project. Install-Package parse -Version 2.0.0-develop-1
Copy Paste Code:

// Instantiate a ParseClient.
ParseClient client = new ParseClient(back4app_app_id,back4app_server_url, clientKey);

  var instal = client.Services.GetCurrentInstallation();
  // Create a user, save it, and authenticate with it.
  await client.SignUpAsync(username: "TestABC", password: "Test");

  // Get the authenticated user. This is can also be done with a variable that stores the ParseUser instance before the SignUp overload that accepts a ParseUser is called.
  var curUser=client.GetCurrentUser();

  // Deauthenticate the user.
  await client.LogOutAsync();

  // Authenticate the user.
  ParseUser user = client.LogInAsync(username: "Test", password: "Test").Result;

Actual Outcome

await client.SignUpAsync(username: "TestABC", password: "Test");
throws following exception:
System.ArgumentNullException: 'Value cannot be null.Parameter name: element'

Expected Outcome

After SignUpAsync() Function client.GetCurrentUser() should return current User

Environment

Server

  • Parse Server version: 4.2.0
  • Local or remote host (AWS, Azure, Google Cloud, Heroku, Digital Ocean, etc): Back4APP

Client

  • Parse .NET SDK version: -Version 2.0.0-develop-1
  • Xamarin.Forms Project is .NET 2.1
@thibautvdu
Copy link

I'm facing the exact same error with the function CallCloudCodeFunctionAsync
Xamarin Forms shared project too.

@stale
Copy link

stale bot commented Jul 21, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Jul 21, 2021
@sschaub
Copy link

sschaub commented Aug 5, 2021

I recently encountered this same issue. The problem and the solution is referenced in other issues here, such as #344. Namely, you have to follow the procedure in the README for the Unity client: https://github.com/parse-community/Parse-SDK-dotNET#use-in-unity-client

You have to adapt it a bit for Xamarin. Here is what I've used to get it working with Xamarin Forms 5:

var client = new ParseClient(new ServerConnectionData
            {
                ApplicationID = "...",
                Key = "...",
                ServerURI = "..."
            },
            new LateInitializedMutableServiceHub(),
            new MetadataMutator
            {
                EnvironmentData = new EnvironmentData { OSVersion = Environment.OSVersion.ToString(), Platform = Device.RuntimePlatform, TimeZone = TimeZoneInfo.Local.StandardName },
                HostManifestData = new HostManifestData {
                    Version = this.GetType().Assembly.GetCustomAttribute<AssemblyInformationalVersionAttribute>().InformationalVersion,
                    Name = this.GetType().Assembly.GetName().Name,
                    ShortVersion = this.GetType().Assembly.GetName().Version.ToString(),
                    Identifier = AppDomain.CurrentDomain.FriendlyName
                }
            });

@stale stale bot removed the stale label Aug 5, 2021
@hhgz9527
Copy link

hhgz9527 commented Sep 8, 2021

ServerURI need add / to last, such as http://localhost:1337/api/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants