mirror of
https://github.com/RevenueCat/purchases-ios
synced 2026-11-11 22:55:55 +05:45
Checking for the presence of `Xcode/DerivedData` in the receipt path was failing for TestFlight builds or if the .app bundle generated by Xcode was moved from the folder. Additionally, checking for `MASReceipt/receipt` seems less robust than simply using compiler directives. Instead, for macOS apps, we check the environment embedded in the receipt and alternatively check the signature of the app bundle. --------- Co-authored-by: NachoSoto <NachoSoto@users.noreply.github.com>
29 lines
907 B
Swift
29 lines
907 B
Swift
//
|
|
// Copyright RevenueCat Inc. All Rights Reserved.
|
|
//
|
|
// Licensed under the MIT License (the "License");
|
|
// you may not use this file except in compliance with the License.
|
|
// You may obtain a copy of the License at
|
|
//
|
|
// https://opensource.org/licenses/MIT
|
|
//
|
|
// PurchasesReceiptParser+Extensions.swift
|
|
//
|
|
// Created by Nacho Soto on 12/14/22.
|
|
|
|
import Foundation
|
|
|
|
public extension PurchasesReceiptParser {
|
|
|
|
/// A default ``PurchasesReceiptParser`` configured for use.
|
|
static let `default`: PurchasesReceiptParser = .init(logger: ReceiptParserLogger())
|
|
|
|
/// Fetches and parses the local receipt
|
|
/// - Returns: ``AppleReceipt`` of the parsed local receipt.
|
|
/// - Throws: ``PurchasesReceiptParser/Error`` if fetching or parsing failed.
|
|
func fetchAndParseLocalReceipt() throws -> AppleReceipt {
|
|
return try LocalReceiptFetcher().fetchAndParseLocalReceipt()
|
|
}
|
|
|
|
}
|