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

Prevent a warning when compiling for Mac Catalyst #247

Merged
merged 1 commit into from
May 14, 2020
Merged

Prevent a warning when compiling for Mac Catalyst #247

merged 1 commit into from
May 14, 2020

Conversation

Timac
Copy link
Contributor

@Timac Timac commented May 14, 2020

Description:

As described on https://developer.apple.com/documentation/storekit/skpaymenttransactionobserver/2877502-paymentqueue?language=objc , the method - (BOOL)paymentQueue:(SKPaymentQueue *)queue shouldAddStorePayment:(SKPayment *)payment forProduct:(SKProduct *)product is only available for iOS and tvOS but not for Mac Catalyst.

However PURCHASES_INITIATED_FROM_APP_STORE_AVAILABLE is set to 1 for Mac Catalyst which leads to a unavailable method warning:

RevenueCat/purchases-ios/Purchases/Purchasing/RCStoreKitWrapper.m:87:1: warning: implementing unavailable method [-Wdeprecated-implementations]
- (BOOL)paymentQueue:(SKPaymentQueue *)queue shouldAddStorePayment:(SKPayment *)payment forProduct:(SKProduct *)product
^
In module 'StoreKit' imported from RevenueCat/purchases-ios/Purchases/Purchasing/RCStoreKitWrapper.h:10:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/iOSSupport/System/Library/Frameworks/StoreKit.framework/Headers/SKPaymentQueue.h:99:1: note: method 'paymentQueue:shouldAddStorePayment:forProduct:' declared here
- (BOOL)paymentQueue:(SKPaymentQueue *)queue shouldAddStorePayment:(SKPayment *)payment forProduct:(SKProduct *)product NS_SWIFT_NAME(paymentQueue(_:shouldAddStorePayment:for:)) API_AVAILABLE(ios(11.0)) API_UNAVAILABLE(macos, macCatalyst, watchos);

Steps to reproduce

  1. Compile Purchases iOS for Mac Catalyst

Result: You see the warning.

Proposed solution:

To fix this warning, PURCHASES_INITIATED_FROM_APP_STORE_AVAILABLE is set to 0 when compiling for Mac Catalyst.

As described on https://developer.apple.com/documentation/storekit/skpaymenttransactionobserver/2877502-paymentqueue?language=objc , the method - (BOOL)paymentQueue:(SKPaymentQueue *)queue shouldAddStorePayment:(SKPayment *)payment forProduct:(SKProduct *)product is only available for iOS and tvOS but not for Mac Catalyst.

However PURCHASES_INITIATED_FROM_APP_STORE_AVAILABLE was set to 1 for Mac Catalyst which led to a unavailable method warning:

RevenueCat/purchases-ios/Purchases/Purchasing/RCStoreKitWrapper.m:87:1: warning: implementing unavailable method [-Wdeprecated-implementations]
- (BOOL)paymentQueue:(SKPaymentQueue *)queue shouldAddStorePayment:(SKPayment *)payment forProduct:(SKProduct *)product
^
In module 'StoreKit' imported from RevenueCat/purchases-ios/Purchases/Purchasing/RCStoreKitWrapper.h:10:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/iOSSupport/System/Library/Frameworks/StoreKit.framework/Headers/SKPaymentQueue.h:99:1: note: method 'paymentQueue:shouldAddStorePayment:forProduct:' declared here
- (BOOL)paymentQueue:(SKPaymentQueue *)queue shouldAddStorePayment:(SKPayment *)payment forProduct:(SKProduct *)product NS_SWIFT_NAME(paymentQueue(_:shouldAddStorePayment:for:)) API_AVAILABLE(ios(11.0)) API_UNAVAILABLE(macos, macCatalyst, watchos);

The fix this warning, PURCHASES_INITIATED_FROM_APP_STORE_AVAILABLE is set to 0 when compiling for Mac Catalyst.
@aboedo aboedo self-requested a review May 14, 2020 17:07
@aboedo
Copy link
Member

aboedo commented May 14, 2020

hi! thanks for opening! and nice catch 😎
it looks like RCCrossPlatformSupport.h makes the assumption that on Catalyst,
TARGET_OS_MACCATALYST == 1 and TARGET_OS_IOS == 0, but it's actually

TARGET_OS_MACCATALYST == 1 and TARGET_OS_IOS == 1.

it only is an issue for this line, the rest just happen to work, but I'll do a pass at cleaning this up as a follow-up PR.

Merging this one. Thanks again @Timac for opening!

@aboedo aboedo merged commit 5ccad4c into RevenueCat:develop May 14, 2020
@Timac Timac deleted the feature/CatalystUnavailableMethodWarning branch May 14, 2020 18:37
@aboedo aboedo mentioned this pull request Jul 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants