question

HackerTester avatar image
HackerTester asked

Getting null reference from setting GetfriendList request.profileconstraints.showtags = true; leading to null reference

Getting null reference from setting GetfriendList request.profileconstraints.showtags = true; leading to null reference btw Tags in client options in game manager turned on and while login and register also show tags = true in request formation please tell what i am doing wrong...

public void GetFriendsList(){        

GetFriendsListRequest request = new GetFriendsListRequest();        

request.IncludeSteamFriends = false;        

request.IncludeFacebookFriends = false;        

request.XboxToken = null;        

request.ProfileConstraints.ShowTags = true;          

PlayFabClientAPI.GetFriendsList(request, result => {              

var FriendList = result.Friends;              

foreach (PlayFab.ClientModels.FriendInfo Friend in FriendList){                

	foreach(string tag in Friend.Tags)                

	{                    

		switch (tag){                        

			case "your_defined_tag":                            

				//do action                            

				break;

	                        default:                            												

				break;                      

}                

	}                            

		}        

},OnFailure);}      

private void OnFailure(PlayFabError error)    

{        

Debug.Log(error.GenerateErrorReport());    #

}
2 comments
10 |1200

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

Seth Du avatar image Seth Du ♦ commented ·

What's the full content in the callback result? Have you tested this API in any RESTful testing tools like Postman?

0 Likes 0 ·
HackerTester avatar image HackerTester Seth Du ♦ commented ·

@SethDu i am receiving null on Show Tags = true; if remove this line i didn't get any null error

0 Likes 0 ·

1 Answer

·
HackerTester avatar image
HackerTester answered

@SethDu

I don't Know does it make any sense or what but

// this code works the upper one doesn't please tell me playfab how this makes  sense


public void GetFriendsList(System.Action<GetFriendsListResult> result, System.Action<PlayFabError> error){


            PlayFabClientAPI.GetFriendsList(new GetFriendsListRequest()
            {
                IncludeSteamFriends = false,
                IncludeFacebookFriends = false,
                XboxToken = null,
                ProfileConstraints = new PlayerProfileViewConstraints{
                    
                    ShowTags = true,
                }
            },result, error);

        }



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.