crash updating in app purchase visibility with SKProductStorePromotionController

Hi,


I'm trying to use the new in app purchace promotion apis - in particular the visibility ones. Though this is something I can't replicate locally, I am consistently getting crash reports. See end of message. I can't figure out what they mean or what they are happening. when my app starts up, I fetch all product types and update their visibiity accordingly. Everything is stored with a strong reference. Here's an example of the code (using swiftystorekit):


SwiftyStoreKit.retrieveProductsInfo(Set(productIdsToFormattedPrice.keys)) { [weak self] result in

for product in result.retrievedProducts {

if (self?.settings.isAppleWatchUpgraded() ?? false) {

self?.storePromotions?.hide(product: product)

} else {

self?.storePromotions?.promote(product: product)

}

}


storePromotions is a strong wrapper over SKProductStorePromotionController, which it accesses with SKProductStorePromotionController.default()


Does anyone have an idea of what this is?


Thank you


Exception Type: EXC_BAD_ACCESS (SIGSEGV)

Exception Subtype: KERN_INVALID_ADDRESS at 0x0000000000000010

VM Region Info: 0x10 is not in any region. Bytes before following region: 4296556528

REGION TYPE START - END [ VSIZE] PRT/MAX SHRMOD REGION DETAIL

UNUSED SPACE AT START

--->

__TEXT 0000000100184000-0000000100188000 [ 16K] r-x/r-x SM=COW ...pp/CycleMaps]



Termination Signal: Segmentation fault: 11

Termination Reason: Namespace SIGNAL, Code 0xb

Terminating Process: exc handler [0]

Triggered by Thread: 2

Thread 2 name:

Thread 2 Crashed:

0 StoreKit 0x0000000197968598 __97-[SKProductStorePromotionController updateStorePromotionVisibility:forProduct:completionHandler:]_block_invoke + 220 (SKProductStorePromotionController.m:83)

1 StoreKit 0x000000019795d1e4 __50-[SKPromotedIAPSetVisibilityRequest _handleReply:]_block_invoke + 56 (SKPromotedIAPSetVisibilityRequest.m:54)

2 StoreKit 0x000000019795d1e4 __50-[SKPromotedIAPSetVisibilityRequest _handleReply:]_block_invoke + 56 (SKPromotedIAPSetVisibilityRequest.m:54)

3 libdispatch.dylib 0x0000000183fe1088 _dispatch_call_block_and_release + 24 (init.c:994)

Replies

I ran into this same issue in my app, it turned out to only affect iOS 11.0.x until 11.1 (fixed in 11.1) I think this is an apple bug that they've since fixed. Not sure what causes it though or how to solve it given that we'd still want to hide/show promoted IAPs for those OS versions. For now I am just going to switch to call this only for 11.1 and above.

I know this is an old issue, but I'm curious if it's still happening.


I ran into the same issue back in the day (even in 11.1) and decided to just not use the API for the time being.

Is it fixed now?

yeah - i eventually raised it with apple as a bug. was fixed.