应用内购买设置的密码显示您输入的 Apple ID 不能是字体,即使它是正确的
Password for in app purchases setup says Apple ID you entered couldn't be font even if its right
每当我在提示出现后输入密码时,即使它说的是正确的,它也会要求我输入密码。 password can't be fond“您输入的 Apple ID 无法使用您的密码不正确。删除添加按钮没有任何作用
代码:
import Foundation
import AVFoundation
import SpriteKit
import GameKit
import UIKit
import StoreKit
class ThirdScene: SKScene, SKPaymentTransactionObserver, SKProductsRequestDelegate {
let RemoveaddsButton = SKSpriteNode(imageNamed: "PlayAltenative")
let RestorePurchases = SKSpriteNode(imageNamed: "StopButton")
var iAdLabel = SKLabelNode()
override func didMoveToView(view: SKView) {
SKPaymentQueue.defaultQueue().addTransactionObserver(self)
//----------------------------------------------
iAdLabel.text = "I am An Advertisment"
iAdLabel.fontSize = 20
iAdLabel.zPosition = 20
iAdLabel.fontColor = SKColor.whiteColor()
iAdLabel.position = CGPoint(x: self.frame.size.width/2, y: self.frame.size.height * 0.70)
self.addChild(iAdLabel)
//-----------------------------------------------------------------------
self.RemoveaddsButton.position = CGPoint(x: self.frame.size.width * 0.70, y: self.frame.size.height * 0.20)
RemoveaddsButton.zPosition = 100
RemoveaddsButton.size = CGSize(width: 115, height: 170)
self.addChild(self.RemoveaddsButton)
//-----------------------------------------------------
self.RestorePurchases.position = CGPoint(x: self.frame.size.width * 0.10, y: self.frame.size.height * 0.20)
RestorePurchases.zPosition = 100
RestorePurchases.size = CGSize(width: 115, height: 170)
self.addChild(self.RestorePurchases)
if(SKPaymentQueue.canMakePayments()) {
println("IAP is enabled, loading")
var productID:NSSet = NSSet(objects: "SkateLinesNolliePackage")
var request: SKProductsRequest = SKProductsRequest(productIdentifiers: productID as Set<NSObject>)
request.delegate = self
request.start()
} else {
println("please enable IAPS")
}
}
var list = [SKProduct]()
var p = SKProduct()
func buyProduct() {
println("buy " + p.productIdentifier)
var pay = SKPayment(product: p)
SKPaymentQueue.defaultQueue().addTransactionObserver(self)
SKPaymentQueue.defaultQueue().addPayment(pay as SKPayment)
}
func productsRequest(request: SKProductsRequest!, didReceiveResponse response: SKProductsResponse!) {
println("product request")
var myProduct = response.products
for product in myProduct {
println("product added")
println(product.productIdentifier)
println(product.localizedTitle)
println(product.localizedDescription)
println(product.price)
list.append(product as! SKProduct)
}
}
func removeAd() {
iAdLabel.position = CGPoint(x: self.frame.size.width/2, y: self.frame.size.height * 9.70)
}
func paymentQueueRestoreCompletedTransactionsFinished(queue: SKPaymentQueue!) {
println("transactions restored")
var purchasedItemIDS = []
for transaction in queue.transactions {
var t: SKPaymentTransaction = transaction as! SKPaymentTransaction
let prodID = t.payment.productIdentifier as String
switch prodID {
case "SkateLinesNolliePackage":
removeAd()
default:
println("IAP not setup")
}
}
var alert = UIAlertView(title: "Thank You", message: "Your purchase(s) were restored. You may have to restart the app before banner ads are removed.", delegate: nil, cancelButtonTitle: "OK")
alert.show()
}
func paymentQueue(queue: SKPaymentQueue!, updatedTransactions transactions: [AnyObject]!) {
println("add paymnet")
for transaction:AnyObject in transactions {
var trans = transaction as! SKPaymentTransaction
println(trans.error)
switch trans.transactionState {
case .Purchased, .Restored:
println("buy, ok unlock iap here")
println(p.productIdentifier)
let prodID = p.productIdentifier as String
switch prodID {
case "SkateLinesNolliePackage":
//Here you should put the function you want to execute when the purchase is complete
var alert = UIAlertView(title: "Thank You", message: "You may have to restart the app before the banner ads are removed.", delegate: nil, cancelButtonTitle: "OK")
alert.show()
default:
println("IAP not setup")
}
queue.finishTransaction(trans)
break;
case .Failed:
println("buy error")
queue.finishTransaction(trans)
break;
default:
println("default")
break;
}
}
}
func finishTransaction(trans:SKPaymentTransaction)
{
println("finish trans")
}
func paymentQueue(queue: SKPaymentQueue!, removedTransactions transactions: [AnyObject]!)
{
println("remove trans");
}
override func touchesBegan(touches: Set<NSObject>, withEvent event: UIEvent) {
for touch: AnyObject in touches {
name = "RemoveaddsButton"
let location = touch.locationInNode(self)
if self.nodeAtPoint(location) == self.RemoveaddsButton {
for product in list {
var prodID = product.productIdentifier
if(prodID == "SkateLinesNolliePackage") {
p = product
buyProduct() //This is one of the functions we added earlier
break;
}
}
}
let location1 = touch.locationInNode(self)
if self.nodeAtPoint(location1) == self.RestorePurchases {
SKPaymentQueue.defaultQueue().restoreCompletedTransactions()
SKPaymentQueue.defaultQueue().addTransactionObserver(self)
}
}
}
}
听起来您需要一个沙盒测试器。转到 iTunes Connect,单击我的应用程序,然后单击您制作的应用程序。接下来,单击预发布。之后,单击内部测试人员。完成后,单击用户和角色。然后,单击沙盒测试器并使用未在任何其他 apple id 中使用的假电子邮件和密码创建一个测试器。然后应用内购买应该使用该 ID。
每当我在提示出现后输入密码时,即使它说的是正确的,它也会要求我输入密码。 password can't be fond“您输入的 Apple ID 无法使用您的密码不正确。删除添加按钮没有任何作用
代码:
import Foundation
import AVFoundation
import SpriteKit
import GameKit
import UIKit
import StoreKit
class ThirdScene: SKScene, SKPaymentTransactionObserver, SKProductsRequestDelegate {
let RemoveaddsButton = SKSpriteNode(imageNamed: "PlayAltenative")
let RestorePurchases = SKSpriteNode(imageNamed: "StopButton")
var iAdLabel = SKLabelNode()
override func didMoveToView(view: SKView) {
SKPaymentQueue.defaultQueue().addTransactionObserver(self)
//----------------------------------------------
iAdLabel.text = "I am An Advertisment"
iAdLabel.fontSize = 20
iAdLabel.zPosition = 20
iAdLabel.fontColor = SKColor.whiteColor()
iAdLabel.position = CGPoint(x: self.frame.size.width/2, y: self.frame.size.height * 0.70)
self.addChild(iAdLabel)
//-----------------------------------------------------------------------
self.RemoveaddsButton.position = CGPoint(x: self.frame.size.width * 0.70, y: self.frame.size.height * 0.20)
RemoveaddsButton.zPosition = 100
RemoveaddsButton.size = CGSize(width: 115, height: 170)
self.addChild(self.RemoveaddsButton)
//-----------------------------------------------------
self.RestorePurchases.position = CGPoint(x: self.frame.size.width * 0.10, y: self.frame.size.height * 0.20)
RestorePurchases.zPosition = 100
RestorePurchases.size = CGSize(width: 115, height: 170)
self.addChild(self.RestorePurchases)
if(SKPaymentQueue.canMakePayments()) {
println("IAP is enabled, loading")
var productID:NSSet = NSSet(objects: "SkateLinesNolliePackage")
var request: SKProductsRequest = SKProductsRequest(productIdentifiers: productID as Set<NSObject>)
request.delegate = self
request.start()
} else {
println("please enable IAPS")
}
}
var list = [SKProduct]()
var p = SKProduct()
func buyProduct() {
println("buy " + p.productIdentifier)
var pay = SKPayment(product: p)
SKPaymentQueue.defaultQueue().addTransactionObserver(self)
SKPaymentQueue.defaultQueue().addPayment(pay as SKPayment)
}
func productsRequest(request: SKProductsRequest!, didReceiveResponse response: SKProductsResponse!) {
println("product request")
var myProduct = response.products
for product in myProduct {
println("product added")
println(product.productIdentifier)
println(product.localizedTitle)
println(product.localizedDescription)
println(product.price)
list.append(product as! SKProduct)
}
}
func removeAd() {
iAdLabel.position = CGPoint(x: self.frame.size.width/2, y: self.frame.size.height * 9.70)
}
func paymentQueueRestoreCompletedTransactionsFinished(queue: SKPaymentQueue!) {
println("transactions restored")
var purchasedItemIDS = []
for transaction in queue.transactions {
var t: SKPaymentTransaction = transaction as! SKPaymentTransaction
let prodID = t.payment.productIdentifier as String
switch prodID {
case "SkateLinesNolliePackage":
removeAd()
default:
println("IAP not setup")
}
}
var alert = UIAlertView(title: "Thank You", message: "Your purchase(s) were restored. You may have to restart the app before banner ads are removed.", delegate: nil, cancelButtonTitle: "OK")
alert.show()
}
func paymentQueue(queue: SKPaymentQueue!, updatedTransactions transactions: [AnyObject]!) {
println("add paymnet")
for transaction:AnyObject in transactions {
var trans = transaction as! SKPaymentTransaction
println(trans.error)
switch trans.transactionState {
case .Purchased, .Restored:
println("buy, ok unlock iap here")
println(p.productIdentifier)
let prodID = p.productIdentifier as String
switch prodID {
case "SkateLinesNolliePackage":
//Here you should put the function you want to execute when the purchase is complete
var alert = UIAlertView(title: "Thank You", message: "You may have to restart the app before the banner ads are removed.", delegate: nil, cancelButtonTitle: "OK")
alert.show()
default:
println("IAP not setup")
}
queue.finishTransaction(trans)
break;
case .Failed:
println("buy error")
queue.finishTransaction(trans)
break;
default:
println("default")
break;
}
}
}
func finishTransaction(trans:SKPaymentTransaction)
{
println("finish trans")
}
func paymentQueue(queue: SKPaymentQueue!, removedTransactions transactions: [AnyObject]!)
{
println("remove trans");
}
override func touchesBegan(touches: Set<NSObject>, withEvent event: UIEvent) {
for touch: AnyObject in touches {
name = "RemoveaddsButton"
let location = touch.locationInNode(self)
if self.nodeAtPoint(location) == self.RemoveaddsButton {
for product in list {
var prodID = product.productIdentifier
if(prodID == "SkateLinesNolliePackage") {
p = product
buyProduct() //This is one of the functions we added earlier
break;
}
}
}
let location1 = touch.locationInNode(self)
if self.nodeAtPoint(location1) == self.RestorePurchases {
SKPaymentQueue.defaultQueue().restoreCompletedTransactions()
SKPaymentQueue.defaultQueue().addTransactionObserver(self)
}
}
}
}
听起来您需要一个沙盒测试器。转到 iTunes Connect,单击我的应用程序,然后单击您制作的应用程序。接下来,单击预发布。之后,单击内部测试人员。完成后,单击用户和角色。然后,单击沙盒测试器并使用未在任何其他 apple id 中使用的假电子邮件和密码创建一个测试器。然后应用内购买应该使用该 ID。