question

Laarni avatar image
Laarni asked

Is there a way to fetch the itemID or displayname in the result when i use purchaseItem?

Basically, i am using the api call and it works perfect. The only thing is that the displayname of the object has to be loaded in a UILabel. But it crashes the app. So i figured out why and it turned out that the result of purchaseItem does not show the same result that i am suppose to have according to the API call documentation. The debug console shows :

(

"<ItemInstance: 0x6000000f9680>"

).


Here is my code (XCODE obj C)

 [[PlayFabClientAPI GetInstance]

         PurchaseItem:request success:^(PurchaseItemResult *result, NSObject *userData) {

             NSLog(@"%@", result.Items);

             

             NSLog(@"Clue bought.");

         } failure:^(PlayFabError *error, NSObject *userData) {

        

             NSLog(@"error %@",error.errorMessage);

         } withUserData:nil];


10 |1200

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

1 Answer

·
brendan avatar image
brendan answered

Actually, both the ItemId and the DisplayName are returned from a successful call to PurchaseItem. You can see this by testing the call in the documentation site (the "TryIt" feature), or via Postman. Specifically, the PurchaseItemResult contains an array of Items, each of which is an ItemInstance, which contains all the elements specific to the item in question.

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.

Laarni avatar image Laarni commented ·

That s exactly where i do not understand why. You are right, it works perfectly on the Try It and shows all the informations but not on xcode... I ll keep digging to find a workarround.

0 Likes 0 ·
brendan avatar image brendan Laarni commented ·

If you're using our ObjectiveC SDK, please bear in mind that it is still beta. Once we've had a chance to do thorough, end-to-end testing on it and make any changes needed to make sure it meets our standard for a production SDK, we'll be moving it out of beta.

0 Likes 0 ·

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.