Application crash if productRequest returns an empty array of products #2

Closed
frankdilo opened this Issue Sep 29, 2012 · 1 comment

Comments

Projects
None yet
2 participants

I'm getting this behavior on iOS 5: if the products request returns an empty array of products the application crashes.

I've tracked this down to CargoBay and in particular to one line of code in CargoBay.m, in the productsRequest:didReceiveResponse: method.

- (void)productsRequest:(SKProductsRequest *)request
     didReceiveResponse:(SKProductsResponse *)response
{
    if (_success) {
        _success(response.products, response.invalidProductIdentifiers);
    }

     // commenting the line below remove the crash
    //[[self class] unregisterDelegate:self];
}

Hope it helps and it's not a problem I created in my specific situation.

@mattt mattt added a commit that referenced this issue Oct 1, 2012

@mattt mattt [Issue #2] Fix for crash related to race condition of success / failu…
…re blocks of delegate objects
b94754b
Owner

mattt commented Oct 1, 2012

Ah, I think I understand what's going on there. It would appear that there may be a race condition between the success block and the delegate being released. b94754b makes it so that the success block and the delegate unregistration occur on the same thread, synchronously. Let me know if that fixes your problem.

mattt closed this Oct 14, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment