From 0239c0cb7edae7cda42cd58699aa68752ce7c3cc Mon Sep 17 00:00:00 2001 From: Tom Poole Date: Thu, 27 Jun 2019 15:37:23 +0100 Subject: [PATCH] iOS: Fixed a crash in InAppPurchases --- .../native/juce_ios_InAppPurchases.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/modules/juce_product_unlocking/native/juce_ios_InAppPurchases.cpp b/modules/juce_product_unlocking/native/juce_ios_InAppPurchases.cpp index 734de7a8c1..cc25f5ec51 100644 --- a/modules/juce_product_unlocking/native/juce_ios_InAppPurchases.cpp +++ b/modules/juce_product_unlocking/native/juce_ios_InAppPurchases.cpp @@ -94,7 +94,16 @@ struct InAppPurchases::Pimpl : public SKDelegateAndPaymentObserver /** AppStore implementation of hosted content download. */ struct DownloadImpl : public Download { - DownloadImpl (SKDownload* downloadToUse) : download (downloadToUse) {} + DownloadImpl (SKDownload* downloadToUse) + : download (downloadToUse) + { + [download retain]; + } + + ~DownloadImpl() + { + [download release]; + } String getProductId() const override { return nsStringToJuce (download.contentIdentifier); } String getContentVersion() const override { return nsStringToJuce (download.contentVersion); }