Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support didRevokeEntitlementsForProductIdentifiers #71

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

imWildCat
Copy link

In a WWDC 20 session, StoreKit testing was introduced.

This PR aims to support revoking IAP.

@@ -0,0 +1,48 @@
{
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need inputs: Not sure whether we need this .storekit configuration file for the example?

_ = self.configuration.storage.removeRecord(forProductIdentifier: product.identifier)
}
case .failure(let error):
self.logger.log(message: "\(error)", category: .tasks)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.failure is always the result. Not sure where I can fix it?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be related to #66

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prolly, sorry haven't had a chance to investigate that ticket yet.

@@ -54,6 +54,8 @@ extension AppDelegate : MerchantDelegate {
// You could adjust some global interface element here, or simply do nothing, if appropriate.
// For this example, we toggle the `UIApplication.shared.isNetworkActivityIndicatorVisible` property to show a loading indicator in the status bar.
public func merchantDidChangeLoadingState(_ merchant: Merchant) {
UIApplication.shared.isNetworkActivityIndicatorVisible = merchant.isLoading
DispatchQueue.main.async {
UIApplication.shared.isNetworkActivityIndicatorVisible = merchant.isLoading
Copy link
Author

@imWildCat imWildCat May 18, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Screen Shot 2021-05-18 at 23 43 21

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you have the full call stack here?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This delegate should always be called from the main thread so the bug here is inside MerchantKit itself, not the example proj.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, it's my fault!

Thread 2 Queue : com.apple.NSXPCConnection.m-user.com.apple.storekitservice (serial)
#0	0x000000010c4913f0 in AppDelegate.merchantDidChangeLoadingState(_:) at merchantkit/Example/Source/AppDelegate.swift:57
#1	0x000000010c4914a9 in protocol witness for MerchantDelegate.merchantDidChangeLoadingState(_:) in conformance AppDelegate ()
#2	0x000000010c7718c8 in Merchant.updateLoadingStateIfNecessary() at merchantkit/Source/Merchant.swift:200
#3	0x000000010c76f450 in Merchant.checkReceipt(updateProducts:policy:reason:completion:) at merchantkit/Source/Merchant.swift:276
#4	0x000000010c77b420 in Merchant.storeInterface(_:didRevokeEntitlementsForProductIdentifiers:) at merchantkit/Source/Merchant.swift:510
#5	0x000000010c77c2f9 in protocol witness for StoreInterfaceDelegate.storeInterface(_:didRevokeEntitlementsForProductIdentifiers:) in conformance Merchant ()
#6	0x000000010c7b0e1d in StoreKitTransactionObserver.paymentQueue(_:didRevokeEntitlementsForProductIdentifiers:) at merchantkit/Source/Internal/StoreKitStoreInterface/StoreKitTransactionObserver.swift:94
#7	0x000000010c7b0ed0 in @objc StoreKitTransactionObserver.paymentQueue(_:didRevokeEntitlementsForProductIdentifiers:) ()
#8	0x00007fff307898e9 in __59-[SKPaymentQueue removedEntitlementsForProductIdentifiers:]_block_invoke ()
#9	0x00007fff20393eaf in __NSARRAY_IS_CALLING_OUT_TO_A_BLOCK__ ()
#10	0x00007fff20320507 in -[__NSArrayM enumerateObjectsWithOptions:usingBlock:] ()
#11	0x00007fff3078984f in -[SKPaymentQueue removedEntitlementsForProductIdentifiers:] ()
#12	0x00007fff367eca23 in -[ASDStoreKitClientBroker removedEntitlementsForProductIdentifiers:] ()
#13	0x00007fff2092cbd7 in __NSXPCCONNECTION_IS_CALLING_OUT_TO_EXPORTED_OBJECT_S1__ ()
#14	0x00007fff2092b90f in -[NSXPCConnection _decodeAndInvokeMessageWithEvent:flags:] ()
#15	0x00007fff2092cf06 in message_handler ()
#16	0x00007fff20056cf8 in _xpc_connection_call_event_handler ()
#17	0x00007fff2005707c in _xpc_connection_mach_event ()
#18	0x000000010d5717ee in _dispatch_client_callout4 ()
#19	0x000000010d58b80a in _dispatch_mach_msg_invoke ()
#20	0x000000010d577db1 in _dispatch_lane_serial_drain ()
#21	0x000000010d58c6c8 in _dispatch_mach_invoke ()
#22	0x000000010d577db1 in _dispatch_lane_serial_drain ()
#23	0x000000010d578c9d in _dispatch_lane_invoke ()
#24	0x000000010d584a7a in _dispatch_workloop_worker_thread ()
#25	0x00007fff603404c0 in _pthread_wqthread ()
#26	0x00007fff6033f493 in start_wqthread ()

Will fix it by wrap the delegate call back in main thread block.

@benjaminmayo
Copy link
Owner

If you want to merge against master, the receipt validation issue for Xcode Store Kit Test Configuration generated receipts should be resolved.

@imWildCat
Copy link
Author

If you want to merge against master, the receipt validation issue for Xcode Store Kit Test Configuration generated receipts should be resolved.

Sure! Thanks for letting me know!

Will check this PR during my weekend.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants