Skip to main content

3 posts tagged with "iOS"

iOS platform specific features

View All Tags

v2.8.1 Release - Type System Improvements

· One min read
Hyo
Expo IAP Maintainer

This release resolves type mismatches between Product and Purchase types across iOS and Android platforms.

What's New

Type System Improvements

  • Added platform field to all types for runtime type discrimination
  • Moved common fields (ids, debugDescription) to shared base types
  • Fixed iOS native code to populate missing subscription fields

No Breaking Changes

All existing code continues to work. Update to platform-specific field names before v2.9.0:

  • Android: namenameAndroid
  • iOS: displayNamedisplayNameIOS

Important Note

If upgrading from versions before v2.8.0, please review the v2.8.0 migration guide first, as it contains breaking changes for iOS field naming conventions.

Type Discrimination Example

import {Product, Purchase} from 'expo-iap';

function handleProduct(product: Product) {
if (product.platform === 'ios') {
// TypeScript knows this is ProductIOS
console.log(product.isFamilyShareableIOS);
} else if (product.platform === 'android') {
// TypeScript knows this is ProductAndroid
console.log(product.nameAndroid);
}
}

Installation

npm install expo-iap@2.8.1

Next Steps

Deprecated fields will be removed in v2.9.0. Update your code now to ensure smooth migration.

For details, see the full changelog.