ios storekit_在iOS 14中的应用购买和storekit中

ios storekit

Much of the buzz at WWDC2020 was given over to SwiftUI 2.0 and ARKit, so you should forgive yourself for missing a seismic change to the StoreKit framework — a change that will make your life as an app developer far easier.

WWDC2020的大部分讨论都转移到了SwiftUI 2.0和ARKit,因此您应该原谅自己错过了StoreKit框架的重大变化—这一变化将使您作为应用程序开发人员的生活变得更加轻松。

If you read my article Set Up Your SwiftUI App to SupportIn-App Purchases, then you already know half the story. The second half is unchanged, but Apple has added some new rules to the first half with iOS 14. Let’s go over the whole shebang to paint a complete picture just in case you’re new here.

如果您阅读了我的文章“ 将您的SwiftUI应用设置为Support-In-App Purchases” ,那么您已经了解了一半。 下半部分没有变化,但是Apple在iOS 14的上半部分中添加了一些新规则。让我们仔细研究一下整个效果,以防万一您是新手。

In my eyes, the seismic change Apple made was giving you, the developer, the ability to implement in-app purchases in the simulator locally. Being able to implement in-app purchases in full without a developer account allows you to do all your testing offline. Obviously, if you want to earn any money, you’ll need to switch to the more traditional route at some point. But just getting the ball rolling is now far easier.

在我看来,Apple所做的重大改变使开发人员可以在本地模拟器中实现应用内购买。 无需开发者帐户即可完全实施应用内购买,可让您离线进行所有测试。 显然,如果您想赚钱,则需要在某个时候切换到更传统的路线。 但是现在,使球滚动变得容易得多。

I’ll begin by painting a picture of what I want to build. I want to illustrate the three types of in-app purchases you can make:

首先,我要绘制要构建的图片。 我想举例说明您可以进行的三种应用内购买:

  • Consumable (will last as long as you’re running the app)

    消耗品(将在您运行应用程序的过程中持续使用)
  • Non-consumable (in theory, will last forever)

    非消耗品(理论上将永远存在)
  • Subscriptions (renew themselves)

    订阅(续订)

I want to keep things as simple as possible too, so I am going to base my app on the simple idea of an electronic ticket. You can buy a consumable ticket, a pass (a non-consumable ticket) that never expires, or a ticket subscription.

我也想让事情变得尽可能简单,因此我将基于简单的电子票证想法开发我的应用程序。 您可以购买消费票,永不过期的通行证(非消费票)或订购票。

Let’s code. You need to start by creating a project. Use SwiftUI as a User interface. Once created, add two additional files to it. A simple Swift one and a template file that answers to the name StoreKit Configuration:

让我们编码。 您需要先创建一个项目。 将SwiftUI用作用户界面。 创建后,向其中添加两个其他文件。 一个简单的Swift文件和一个模板文件,其名称为StoreKit Configuration

Image for post
Configuration file template for in-app purchases in Xcode.
Xcode中应用内购买的配置文件模板。

Having added those two files

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值