Runtime error when using StoreKit 2

When performing StoreKit 2 operations in my Mac app, even very simple ones like AppStore.sync() a small but steady percentage of users experiences the following error:

systemError(Error Domain=NSCocoaErrorDomain Code=4097 \"connection to service named com.apple.storekitagent\" UserInfo={NSDebugDescription=connection to service named com.apple.storekitagent})

Rebooting or re-downloading the App from the Mac App Store, as well as signing out and in again on the Mac App Store does not solve the issue.

Strangely enough all of the affected users I'm aware of were initially able to perform In-App purchases via the said app. Without any updates or anything else however suddenly after a restart of the app the above error gets thrown by the system.

As I have not found any way to solve this issue yet and the said customers are consequently left without service even though they are paying customers, I am desperate to find help with this issue.

Given the simplicity of the AppStore.sync() method for example I can't imagine the solution to lie in code, but I might of course be wrong.

Thank you, Bastian

Replies

I'm having the same problem and seeing that this question was posted 5 month ago doesn't induce hope to find a fix.

The users where able to subscribe, later the app logs a

com.apple.storekit [Default] Failed in XPC service while enumerating transactions for IterationType.current: Error Domain=NSCocoaErrorDomain Code=4097 "connection to service named com.apple.storekitagent" UserInfo={NSDebugDescription=connection to service named com.apple.storekitagent}

and purchases are not available anymore.

I read that if the user deletes a com.apple.storekitagent folder somewhere and restarts the Mac, it works again but that's not even a good temporary solution.

Seems very familiar the issue we've been experiencing:

https://developer.apple.com/forums/thread/743789

Have you ever found the cause/solution?