2021年4月10日星期六

How can I get in-app purchase subscription period below iOS 11.2?

I am new on in-app purchase. How can I get subscriptionPeriod below iOS 11.2? As I see it is available from iOS 11.2 in SKProduct class. My code is like this:

var durationNumberString: String? {      if #available(iOS 11.2, *) {          guard let nu = product.subscriptionPeriod?.numberOfUnits else { return nil }          return "\(nu)"      } else {          return nil      }  }    var durationUnitString: String? {      if #available(iOS 11.2, *) {          guard let unit = product.subscriptionPeriod?.unit else { return nil }                    switch unit {          case .day:              return "day"          case .week:              return "weak"          case .month:              return "month"          case .year:              return "year"          @unknown default:              return ""          }      } else {          return nil      }  }  

I want to give durationNumberString and durationUnitString values below iOS 11.2 also.

https://stackoverflow.com/questions/67033658/how-can-i-get-in-app-purchase-subscription-period-below-ios-11-2 April 10, 2021 at 07:07PM

没有评论:

发表评论