Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
584 views
in Technique[技术] by (71.8m points)

iphone - SKPaymentQueue addTransactionObserver asking for App Store password on startup after in-app purchase

My app is using in-app purchases, and most of my users can purchase just fine without any problems. For these folks, my app downloads the content after the purchase succeeds and they are happy.

However, for a growing number of my users, once they complete a successful in-app purchase they are being asked for their App Store password every time the app starts up after that. I believe this is happening on the call to:

[[SKPaymentQueue defaultQueue] addTransactionObserver:observer];

which I am calling on startup in accordance with step 6 in Apple's in-app purchase guide:

My guess is that, for some reason, Apple's in-app purchase servers aren't registering that the transaction finished successfully - even though I call

[[SKPaymentQueue defaultQueue] finishTransaction:transaction];

when the transaction is completed and my content has been successfully downloaded.

2 questions:

  1. Is anyone else seeing this?

  2. Does anyone have a suggested fix?

BOUNTY EDIT:

Its a transaction which was made with a different Apple-ID. Thats why it cannot be finished unless you type in the right credentials into the dialog. The Question should be either:

  1. How can I prevent such dead transactions (transaction has not been finished, user has no network, meanwhile changes App-ID)?
  2. How can you prune the SkPaymentQueue?
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

I had the same problem.make sure that you call

[[SKPaymentQueue defaultQueue] finishTransaction:transaction]; 

for all three states of the transactions: SKPaymentTransactionStatePurchased, SKPaymentTransactionStateRestored, SKPaymentTransactionStateFailed.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...