What’s new in Apphud: Free Trials Performance Report, Paddle Integration, SDK Updates, and moreLet’s see
Apphud
Why Apphud?PricingContact
Ren
Ren
February 27, 2023
1 min read

What’s new: iOS SDK Update

In Apphud, we have worked hard on a new major iOS SDK update and are happy to announce that it is now available. Let's take a look at what's new in iOS SDK 3.0.

What’s new: iOS SDK Update

Apphud SDK Availability

Changed minimum deployment target to 13.0. If your app targets iOS 12 devices or lower, you should either upgrade to minimum 13.0 or use the previous SDK version.


Swift Concurrency

We added the ability to purchase products using async/await syntax and modern Product struct as well as some other helpful methods. SDK gently operates with both StoreKit and StoreKit2 frameworks simultaneously.

  • Added the asynchronous func paywalls() async -> [ApphudPaywall] method which returns paywalls with their App Store Product / SKProduct models.
  • Added the asynchronous paywall(_ identifier: String) async -> ApphudPaywall? method which returns a specific paywall by identifier.
  • Added the asynchronous func fetchSKProducts() async -> [SKProduct] method which returns SKProducts for identifiers added in Apphud Product Hub.
  • Added the asynchronous func purchase(_ product: ApphudProduct, isPurchasing: Binding<Bool>? = nil) async -> ApphudPurchaseResult method which returns classic ApphudPurchaseResult.
  • Added the new asynchronous func restorePurchases() async -> Error? method.

StoreKit 2

  • Added the asynchronous fetchProducts() async throws -> [Product] method which returns Product structs for identifiers added in Apphud Product Hub. Throwable.
  • Added the asynchronous func purchase(_ product: Product, isPurchasing: Binding<Bool>? = nil) async -> ApphudAsyncPurchaseResult method which returns a new ApphudAsyncPurchaseResult struct.
  • Added the func apphudProductFor(_ product: Product) -> ApphudProduct? method which returns the corresponding ApphudProduct that matches theProduct struct.
  • Added the asynchronous func product() async throws -> Product? method to the ApphudProduct object. Now you can retrieve both SKProduct and Product models from within ApphudProduct object.

SwiftUI

  • Added optional $isPurchasing Binding to a boolean value that determines whether the payment is currently in process.
  • New Apphud SwiftUI Demo App.

General Changes

  • Added a new var success: Bool to ApphudPurchaseResult.
  • Added a new func didUpdateNotification() -> Notification.Name notification method which is posted whenever any purchase or subscription changes. Useful in Swift and SwiftUI.
  • appleSearchAds enum value made unavailable due to the iAd framework is no longer supported by Apple. Use appleAdsAttribution instead.
  • Removed thegetPaywalls(callback: @escaping ([ApphudPaywall]?, Error?) -> Void) method in favor of paywallsDidLoadCallback(_ callback: @escaping ([ApphudPaywall]) -> Void) and paywalls() async -> [ApphudPaywall] methods.
  • Renamed productsDidFetchCallback to fetchProducts and improved inner logic.
  • Removed therefreshStoreKitProducts method in favor of the improved fetchProducts method.
  • Deprecated the migratePurchasesIfNeeded {} method for iOS 15+ devices.
  • Fixed a bug when the very first in-app purchase was tracked with zero price if the product id was not beforehand added in Product Hub.
  • Added optional callback to the start(apiKey: String, ..., callback: (() -> Void)? = nil) method. Useful for retrieving A/B experiment data as soon as possible.
  • Added optional callback to the startManually(apiKey: String, ..., callback: (() -> Void)? = nil) method. Useful for retrieving A/B experiment data as soon as possible.
  • Multiple refactors and internal improvements.
  • Redesigned Apphud Swift Demo App.

Privacy

  • Added a new func optOutOfTracking() method which opts out a user from tracking some parameters, like IP address, IDFA, IDFV, Device Type.
  • Added initialization delay when an app is inactive and isProtectedDataAvailable is false. Useful for app prewarming in iOS 15+ when the screen is locked.

Custom Purchase Value

You can now set custom purchase value for successful free trial purchases. This value will be used for trial_started events for integrations, like Appsflyer or Facebook.

  • Added a new purchase(_ product: ApphudProduct, value: Double, callback: ((ApphudPurchaseResult) -> Void)?) method.
  • Added the setCustomValueForTrial(_ value: Double, productId: String) method analog for Observer Mode.

Apphud SwiftUI Demo App

What’s inside? In SwiftUI Demo App you will learn how to:

  • Present and dismiss a paywall using the Binding<Bool> variable.
  • Update view according to subscription or app purchase changes using Apphud.didUpdateNotification().
  • Fetch paywalls and display multiple Apphud products on a view using VStack.
  • Control purchase button text and availability.
  • Use the universal helper method to display pricing terms for any product with or without the introductory offer.
  • Make a purchase with both options: SKProduct model or new Product struct.
  • Update UI while a purchase is in the process using $isPurchasing Binding.
  • Dismiss the paywall after a successful app purchase.

Redesigned Apphud Swift Demo App

What’s inside? In Swift Demo App you will learn how to:

  • Update view according to app subscription or purchase changes using Apphud.didUpdateNotification().
  • Fetch paywalls and display multiple Apphud products on a view using UIStackView.
  • Use the universal helper method to display pricing terms for any product with or without the introductory offer.
  • Make a purchase with both options: SKProduct model or new Product struct.
  • Dismiss the paywall after a successful purchase.

Apphud is the in-app subscription infrastructure that helps you increase app revenue. Like Apphud SDK? Feel free to put a star on Github.

Ren
Ren
Co-founder at Apphud
Ex iOS app and game developer. 11 years in the industry since iOS 3. More than 50 apps are in the background with 4 exits. Entrepreneur and traveler.