Skip to content

NSData default constructor to avoid stripping - #54

Closed
EliseoDiegoViola-Snowprint wants to merge 1 commit into
apple:mainfrom
EliseoDiegoViola-Snowprint:fix/NSData_default_constructor
Closed

EliseoDiegoViola-Snowprint wants to merge 1 commit into
apple:mainfrom
EliseoDiegoViola-Snowprint:fix/NSData_default_constructor

Conversation

@EliseoDiegoViola-Snowprint

Copy link
Copy Markdown

These changes add a way to get an empty NSData using a default constructor.
This is needed since GKLocalPlayer.Local.FetchItems() eventually calls OnFetchItems which requires to create an empty NSData at the moment of deserialization.

@ryzngard ryzngard left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the submission and sorry for the delay! I have another PR to address some code stripping #73 , does that solve the issue you were hitting?

Overall I think this change can be simplified to not go across ABI and instead have a default pointer.

/// <summary>
/// Default constructor that initializes an empty NSData instance.
/// </summary>
public NSData() : base(CreateEmptyNSData())

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason to not just use default for the pointer? It looks like that should be handled correctly everywhere

@EliseoDiegoViola-Snowprint

Copy link
Copy Markdown
Author

@ryzngard , yes #73 seems to fix the issue and in a more elegant way :)
As soon that one is merged I would close this one.

@ryzngard

ryzngard commented Dec 4, 2025

Copy link
Copy Markdown
Collaborator

Closing since #73 is now merged

@ryzngard ryzngard closed this Dec 4, 2025
kuoliangkwong pushed a commit to kuoliangkwong/unityplugins that referenced this pull request Jan 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants