SKPayment overrides isEqual without also overriding hash

Originator:ben.dolman
Number:rdar://14222891 Date Originated:20-Jun-2013 05:16 PM
Status:Open Resolved:
Product:iPhone SDK Product Version:6.1
Classification: Reproducible:Always
 
Summary:

According to Apple's documentation, if a class overrides isEqual: it must also override hash to preserve the invariance. SKPayment appears to override isEqual: but not hash.

Steps to Reproduce:

Create a SKPayment object. To do this you'll have to get an SKProduct, which can only be created as part of a SKProductsResponse object, which requires a custom StoreKit setup. Thus, no sample project is provided.

SKProduct *product = ... //Get this from somewhere
SKPayment *paymentA = [SKPayment paymentWithProduct:product];
SKPayment *paymentB = [paymentA copy];

BOOL equal = [paymentA isEqual:paymentB];
NSUInteger hashA = [paymentA hash];
NSUInteger hashB = [paymentB hash];

NSLog(@"isEqual: %d     hashesEqual: %d", isEqual, hashA == hashB);

Expected Results:

isEqual: 1     hashesEqual: 1

Actual Results:

isEqual: 1     hashesEqual: 0

Regression:

Notes:

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!