1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

Xcode: Fix nullability warnings in Xcode 14.3

This commit is contained in:
reuk 2023-02-27 20:45:29 +00:00
parent 3b1b52b65e
commit 28ad953a3a
No known key found for this signature in database
GPG key ID: FCB43929F012EE5C
5 changed files with 52 additions and 13 deletions

View file

@ -374,11 +374,25 @@ struct InAppPurchases::Pimpl
//==============================================================================
void processReceiptRefreshResponseWithSubscriptionsSharedSecret (const String& secret)
{
auto receiptURL = [[NSBundle mainBundle] appStoreReceiptURL];
const auto succeeded = [&]
{
auto receiptURL = [[NSBundle mainBundle] appStoreReceiptURL];
if (receiptURL == nullptr)
return false;
JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE ("-Wnullable-to-nonnull-conversion")
auto receiptData = [NSData dataWithContentsOfURL: receiptURL];
JUCE_END_IGNORE_WARNINGS_GCC_LIKE
if (receiptData == nullptr)
return false;
if (auto receiptData = [NSData dataWithContentsOfURL: receiptURL])
fetchReceiptDetailsFromAppStore (receiptData, secret);
else
return true;
}();
if (! succeeded)
owner.listeners.call ([&] (Listener& l) { l.purchasesListRestored ({}, false, NEEDS_TRANS ("Receipt fetch failed")); });
}
@ -410,7 +424,10 @@ struct InAppPurchases::Pimpl
if (nsurl == nullptr)
return;
JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE ("-Wnullable-to-nonnull-conversion")
const auto storeRequest = [NSMutableURLRequest requestWithURL: nsurl];
JUCE_END_IGNORE_WARNINGS_GCC_LIKE
[storeRequest setHTTPMethod: @"POST"];
[storeRequest setHTTPBody: requestData];
@ -611,7 +628,7 @@ private:
addMethod (@selector (productsRequest:didReceiveResponse:), [] (id self, SEL, SKProductsRequest* request, SKProductsResponse* response)
{
auto& t = getThis (self);
for (auto i = 0; i < t.pendingProductInfoRequests.size(); ++i)
{
auto& pendingRequest = *t.pendingProductInfoRequests[i];
@ -634,7 +651,7 @@ private:
addMethod (@selector (requestDidFinish:), [] (id self, SEL, SKRequest* request)
{
auto& t = getThis (self);
if (auto receiptRefreshRequest = getAs<SKReceiptRefreshRequest> (request))
{
for (auto i = 0; i < t.pendingReceiptRefreshRequests.size(); ++i)
@ -654,7 +671,7 @@ private:
addMethod (@selector (request:didFailWithError:), [] (id self, SEL, SKRequest* request, NSError* error)
{
auto& t = getThis (self);
if (auto receiptRefreshRequest = getAs<SKReceiptRefreshRequest> (request))
{
for (auto i = 0; i < t.pendingReceiptRefreshRequests.size(); ++i)
@ -675,7 +692,7 @@ private:
addMethod (@selector (paymentQueue:updatedTransactions:), [] (id self, SEL, SKPaymentQueue*, NSArray<SKPaymentTransaction*>* transactions)
{
auto& t = getThis (self);
for (SKPaymentTransaction* transaction in transactions)
{
switch (transaction.transactionState)
@ -706,7 +723,7 @@ private:
addMethod (@selector (paymentQueue:updatedDownloads:), [] (id self, SEL, SKPaymentQueue*, NSArray<SKDownload*>* downloads)
{
auto& t = getThis (self);
for (SKDownload* download in downloads)
{
if (auto* pendingDownload = t.getPendingDownloadFor (download))