Skip to content

Build GDT for Catalyst #3525

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

Merged
merged 4 commits into from
Aug 12, 2019
Merged

Build GDT for Catalyst #3525

merged 4 commits into from
Aug 12, 2019

Conversation

paulb777
Copy link
Member

@paulb777 paulb777 commented Aug 7, 2019

Fix Build issues for GDT on Catalyst

This enables building for dependent pods and the tests.

@@ -111,7 +111,14 @@ - (void)storeEvent:(GDTEvent *)event {

// If running in the background, save state to disk and end the associated background task.
if (bgID != GDTBackgroundIdentifierInvalid) {
#if TARGET_OS_MACCATALYST
NSData *data = [NSKeyedArchiver archivedDataWithRootObject:self
Copy link
Contributor

Choose a reason for hiding this comment

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

This is just the new way of doing this and archiveRootObject:toFile: is now deprecated. It seems like this should be the approach on iOS 11+, macOS 10.13+, and on Catalyst.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, since [NSKeyedArchiver archiveRootObject:toFile:] is deprecated, I would suggest using if (@available(...)) instead of #if TARGET_OS_MACCATALYST. An option how it can be done is available here.

Copy link
Contributor

@mikehaney24 mikehaney24 left a comment

Choose a reason for hiding this comment

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

Can you wait until the end of this week? I should be getting a mac that I can install Catalina on soon. I can't test this change until then.

I agree in principle with the changes I think.

@@ -111,7 +111,14 @@ - (void)storeEvent:(GDTEvent *)event {

// If running in the background, save state to disk and end the associated background task.
if (bgID != GDTBackgroundIdentifierInvalid) {
#if TARGET_OS_MACCATALYST
NSData *data = [NSKeyedArchiver archivedDataWithRootObject:self
requiringSecureCoding:NO
Copy link
Contributor

Choose a reason for hiding this comment

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

in theory, you should be able to set this to YES, but hopefully it won't matter for much longer

Copy link
Contributor

@maksymmalyhin maksymmalyhin Aug 8, 2019

Choose a reason for hiding this comment

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

According to a WWDC session (31:17) requiringSecureCoding == YES is the preferred way to work with NSKeyedArchiver. Do you think we can update it here or in a following PR?

@paulb777
Copy link
Member Author

Tests now build and pass on Catalyst, iOS 13, and iOS 10.

error:nil];
[data writeToFile:[GDTStorage archivePath] atomically:YES];
} else {
#if !defined(TARGET_OS_MACCATALYST)
Copy link
Contributor

Choose a reason for hiding this comment

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

is it possible for TARGET_OS_MACCATALYST to ever be defined when !@available(macOS 10.13)?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yep. It's not executed, but it still tries to compile and fails when building for Catalyst.

Copy link
Contributor

@maksymmalyhin maksymmalyhin left a comment

Choose a reason for hiding this comment

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

LGTM

@mikehaney24 mikehaney24 merged commit c5afe85 into master Aug 12, 2019
mikehaney24 added a commit that referenced this pull request Aug 12, 2019
mikehaney24 added a commit that referenced this pull request Aug 12, 2019
mikehaney24 added a commit that referenced this pull request Aug 12, 2019
mikehaney24 added a commit that referenced this pull request Aug 12, 2019
@mikehaney24 mikehaney24 deleted the pb-catalyst-gdt branch August 12, 2019 23:20
@firebase firebase locked and limited conversation to collaborators Oct 10, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants