In-App Purchases crash on iOS 9.3


#1

We are testing in-app purchases on iOS and while it works in newer versions of iOS it crashes on iOS 9.3. Any idea how to fix this?

The exception appears to be in the IAP code at this instruction:
auto priceLocale = nsStringToJuce (skProduct.priceLocale.languageCode);

Stack is as follows:

[__NSCFLocale languageCode]: unrecognized selector sent to instance 0x15d29080’
*** First throw call stack:
(0x221b391b 0x2194ee17 0x221b92b5 0x221b6ee1 0x220e2238 0x77f693 0x77ef59 0x77b16b 0x77c0bf 0x2baef5e7 0x1c50b7f 0x1c50b6b 0x1c55655 0x22175b6d 0x22174067 0x220c3229 0x220c3015 0x236b3ac9 0x26797189 0x664b83 0x4ad0eb 0x296e61 0x21d6b873)
libc++abi.dylib: terminating with uncaught exception of type NSException

#12 0x0077f692 in juce::InAppPurchases::Pimpl::SKProductToIAPProduct(SKProduct*) at /Users/noel/Code/Repositories/CWMP/Builds/iOS/…/…/…/Libs/JUCEMods/JUCE-5.1.2/modules/juce_product_unlocking/native/juce_ios_InAppPurchases.cpp:618
#13 0x0077ef58 in juce::InAppPurchases::Pimpl::notifyProductsInfoReceived(NSArray<SKProduct*>) at /Users/noel/Code/Repositories/CWMP/Builds/iOS/…/…/…/Libs/JUCEMods/JUCE-5.1.2/modules/juce_product_unlocking/native/juce_ios_InAppPurchases.cpp:333
#14 0x0077b16a in juce::InAppPurchases::Pimpl::didReceiveResponse(SKProductsRequest
, SKProductsResponse*) at /Users/noel/Code/Repositories/CWMP/Builds/iOS/…/…/…/Libs/JUCEMods/JUCE-5.1.2/modules/juce_product_unlocking/native/juce_ios_InAppPurchases.cpp:247
#15 0x0077c0be in juce::SKDelegateAndPaymentObserver::Class::didReceiveResponse(objc_object*, objc_selector*, SKProductsRequest*, SKProductsResponse*) at /Users/noel/Code/Repositories/CWMP/Builds/iOS/…/…/…/Libs/JUCEMods/JUCE-5.1.2/modules/juce_product_unlocking/native/juce_ios_InAppPurchases.cpp:78
#16 0x2baef5e6 in __34-[SKProductsRequest _handleReply:]_block_invoke ()
#17 0x01c50b7e in _dispatch_call_block_and_release ()
#18 0x01c50b6a in _dispatch_client_callout ()
#19 0x01c55654 in _dispatch_main_queue_callback_4CF ()
#20 0x22175b6c in CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE ()
#21 0x22174066 in __CFRunLoopRun ()
#22 0x220c3228 in CFRunLoopRunSpecific ()
#23 0x220c3014 in CFRunLoopRunInMode ()
#24 0x236b3ac8 in GSEventRunModal ()
#25 0x26797188 in UIApplicationMain ()
#26 0x00664b82 in juce::juce_iOSMain(int, char const**, void*) at /Users/noel/Code/Repositories/CWMP/Builds/iOS/…/…/…/Libs/JUCEMods/JUCE-5.1.2/modules/juce_gui_basics/native/juce_ios_Windowing.mm:152
#27 0x004ad0ea in juce::JUCEApplicationBase::main(int, char const**) at /Users/noel/Code/Repositories/CWMP/Builds/iOS/…/…/…/Libs/JUCEMods/JUCE-5.1.2/modules/juce_events/messages/juce_ApplicationBase.cpp:238
#28 0x00296e60 in main at /Users/noel/Code/Repositories/CWMP/Source/Momentum/Main.cpp:149

Contents of SKProduct at the time of the crash:
skProduct SKProduct * 0x17e5fdd0
NSObject NSObject
isa Class SKProduct 0x388cfc38
_internal SKProductInternal * 0x17e94140
NSObject NSObject
_contentVersion id 0x0 0x00000000
_downloadable char ‘\0’
_downloadContentLengths id 0x0 0x00000000
_localeIdentifier id 0x0 0x00000000
_localizedDescription __NSCFString * “Unlimited # of Ideas, 5 minutes per idea, MP3” 0x17e84cf0
_localizedTitle __NSCFString * “Momentum Basic” 0x17e6f940
_price NSDecimalNumber * 0x17e853b0
_priceLocale __NSCFLocale * 0x17e911f0
NSLocale NSLocale
NSObject NSObject
isa Class __NSCFLocale 0x39109168
_productIdentifier __NSCFString * “momentumbasic” 0x17e80260


Feature: In-app purchase support on develop
Feature: In-app purchase support on develop
#2

Thanks @nborthwick for pointing this out. This is now fixed on develop, commit 2ff20da