问题描述
我环顾四周,似乎有几个人遇到了这个问题,但似乎没有人解决它:
I've looked around and it seems like several people are having this issue but no-one seems to have solved it:
有些人建议使用这个节点到Objective-C桥来做这件事:
Some people suggest using this Node to Objective-C bridge to do it:
其他人建议使用这个应用内库,但是从什么我可以看到,它只验证收据:
Other people suggest using this in-app library, but from what I can see, it only validates receipts:
有没有人真的设法在Mac App Store的Electron应用程序中实现应用内购买?
Has anyone actually managed to implement in-app purchases in an Electron app for the Mac App Store?
你是怎么做到的?
如果没有人这样做,那根本不可能吗?
If no one has done it, is it simply impossible to do?
推荐答案
第一个解决方案
我已经实施了这个解决方案,它在开发中工作(尚未在生产中测试)。
First solution
I have implemented this solution and it works in development (not yet tested in production).
- 使用XCode创建一个执行应用内购买的MacOS应用程序(InAppPurchase)(参见)
- 将 InAppPurchase.app 放在Electron app文件夹中的某个位置
- 使用
require('electron')。shell.openItem
或require('child_process')。spawn('./ InAppPurchase.app/Contents/MacOS/InAppPurchase ');
在您的Electron应用程序中开始应用内购买。
- Create a MacOS application (InAppPurchase) with XCode that performs the in-app purchase (see https://developer.apple.com/library/content/documentation/NetworkingInternet/Conceptual/StoreKitGuide/Introduction.html)
- Put the InAppPurchase.app somewhere in your Electron app folder
- Use
require('electron').shell.openItem
orrequire('child_process').spawn('./InAppPurchase.app/Contents/MacOS/InAppPurchase');
in your Electron app to start the in-app purchase.
这绝对不是干净的解决方案,但它似乎工作...
This is definitely not a clean solution but it seems to work...
我认为它也可以完成与NodObjC。但是,与第一个解决方案相比,这个lib非常重。
I think that it can also be done with NodObjC. However, this lib is very heavy compared to the first solution.
添加应用内购买直接到Electron。
Adding in-app purchase directly to Electron.
如果我可以通过IAP在Mac Apple Store上发布我的Electron应用程序,我会通知你如果我找到了另一个解决方案。
I will keep you informed if I can release my Electron app on the Mac Apple Store with IAP or if I found another solution.
这篇关于在Mac App Store的Electron应用程序中实现应用程序内购买的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!