问题
Last night In-App Purchases were not showing on iOS7 simulator devices but today I didn't even change the code and I started getting the same error on iOS 8 devices as well. this is my class
class InAppC: UITableViewController, SKProductsRequestDelegate, SKPaymentTransactionObserver {
and product requst in viewdid load
if (SKPaymentQueue.canMakePayments()) {
var productIDs:NSSet = NSSet(objects: productOne, productTwo, productThree, productFour, productFive)
var productsRequest:SKProductsRequest = SKProductsRequest(productIdentifiers: productIDs)
productsRequest.delegate = self
productsRequest.start()
}else{
println("can't make purchases")
}
and this is the delegate function
func productsRequest(request: SKProductsRequest!, didReceiveResponse response: SKProductsResponse!) {
println("product found")
}
func request(request: SKRequest!, didFailWithError error: NSError!) {
println(error.localizedDescription)
}
I'm not sure why this is happening because it was listing all the products last night.
Edit- I just tested on my device running iOS 7 but I'm getting same error on device as well.
回答1:
Probably an issue with apple servers, it is not working for us as well on any device. I will suggest not to change your code and just wait till things are back to normal.
回答2:
This does not provide a solution for the problem, but I'm going to share my investigation here, for other people that experience these issues, too.
About the issue
Starting around March, 26th / 27th, it seems that all requests sent to the App Store
using Store Kit
will return one of the following errors:
Error Domain=SKErrorDomain Code=0 "Cannot connect to iTunes Store" UserInfo=0x18433a50 {NSLocalizedDescription=Cannot connect to iTunes Store}
Error Domain=SSErrorDomain Code=2 "Cannot connect to iTunes Store" UserInfo=0x170272100 {NSLocalizedDescription=Cannot connect to iTunes Store}
Affected builds
- affected: builds signed with a
Development-
,Enterprise-
orAd Hoc-Profile
- not affected: live builds in the
App Store
signed with aDistribution-Profile
Just filed in a bug report to Apple. I will keep you updated.
Update
Looks like Apple got the issue solved, and IAPs are working again.
来源:https://stackoverflow.com/questions/29296663/cannot-connect-to-itunes-store