gpt4 book ai didi

ios - 应用内购买 : sorting array of product identifiers

转载 作者:搜寻专家 更新时间:2023-11-01 06:59:40 24 4
gpt4 key购买 nike

我在 RageProducts.swift 中有以下非消耗品。

public struct RageProducts {

// MARK: identifiers product no consumible
private static let s1 = "comic1" // name in itunnesconnect: Comic Vol 01
private static let s2 = "comic2" // name in itunnesconnect: Comic Vol 02
private static let s3 = "comic3" // name in itunnesconnect; Comic Vol 03
private static let s4 = "comic4"
private static let s5 = "comic5"
private static let s6 = "comic6"
private static let s7 = "comic7"
private static let s8 = "comic8"
private static let s9 = "comic9"
private static let s10 = "comic10" // name in itunnesconnect: Comic Vol 10
private static let s11 = "comic11"
private static let s12 = "comic12"
private static let s13 = "comic13"

// MARK .- Set identifiers

private static let myproductsIdentifier: Set<ProductIdentifier> = [RageProducts.s1,
RageProducts.s2,
RageProducts.s3,
RageProducts.s4,
RageProducts.s5,
RageProducts.s6,
RageProducts.s7,
RageProducts.s8,
RageProducts.s9,
RageProducts.s10,
RageProducts.s11,
RageProducts.s12,
RageProducts.s13]
//MARK : Reference to IAPHelper
public static let store = IAPHelper(productIdentifiers: RageProducts.myproductosIdentifiers)

}

一切正常,除了它们在 UITableview 中显示的顺序,它不遵守数组中输入的顺序 (Set <ProductIdentifier>)

这告诉我:

Comic Vol 01
Comic Vol 10
Comic Vol 11
Comic Vol 12
Comic Vol 13
Comic Vol 02
Comic Vol 03
.
.
.
Comic Vol 09

正确的应该是:

Comic Vol 01
Comic Vol 02
Comic Vol 03
Comic Vol 04
Comic Vol 05
.
.
.
Comic Vol 13

有没有办法根据输入的顺序对它们进行排序,或者如何解决这个问题?

Screenshot of how products are displayed

最佳答案

尝试使用数组而不是一个一个地声明它们

public struct RageProducts {

// MARK: identifiers product no consumible
private static let arrayOfIdentifiers = ["comic1", "comic2", "comic3",
"comic4","comic5", "comic6",
"comic7","comic8","comic9",
"comic10","comic11","comic12","comic13"]

// MARK .- Set identifiers

private static let myproductsIdentifier: Set<ProductIdentifier> = [RageProducts.arrayOfIdentifiers]
//MARK : Reference to IAPHelper
public static let store = IAPHelper(productIdentifiers: RageProducts.myproductosIdentifiers)
}

关于ios - 应用内购买 : sorting array of product identifiers,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51452415/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com