InApp not working with iOs 5.1.1 - ios

my app has an inApp purchase which is working fine with my ipad having iOS 5.0.
Now the same build when tested with iOS 5.1.1 giving error in inApp Purchase "Cannot connect to iTunes Store". While debugging i am getting the product list succesfully but getting error when i try to purchase that product...
SKPayment *payment = [SKPayment paymentWithProductIdentifier:productIdentifier];
Is anybody facing this type of error for inApp purchase? Any suggestion will be of great help.
Thanks.

This solution works for me:-
Go to Setting--->General--->Reset--->Reset All Setting, and it's working fine.

You're using paymentWithProductIdentifier: which is deprecated in iOS 5.0, maybe that's the problem.
Try using :paymentWithProduct: instead.
"paymentWithProductIdentifier:
Returns a new payment with the specified product identifier. (Deprecated in iOS 5.0.)" http://developer.apple.com/library/ios/documentation/StoreKit/Reference/StoreKit_Collection/StoreKit_Collection.pdf

Related

Requesting an In App Purchase in iOS 13 fails

I use SwiftyStoreKit to request In App Purchases and get only this error with iOS 13:
Error: Optional(Error Domain=ASDErrorDomain Code=507 "Error decoding object" UserInfo={NSLocalizedDescription=Error decoding object, NSLocalizedFailureReason=Attempted to decode store response})
I cannot request information about the products, nor make purchases with a sand box account. However, it works fine in iOS 12.1 on my device. It does not work with the iPhone 11 simulator or an actual device with iOS 13.
I have found a lot, that the Xcode 11 GM seed 1 beta simulator had this problem, but have not found a solution yet. I also tested it with the new released Xcode 11 GM seed 2 version, but there was no fix for me.
Does anyone have a solution on how I can request and purchase In App Purchases again with iOS 13 installed?
Restarting Xcode and simulator did the trick: now my in-app purchases load properly in iOS 13 simulator.
EDIT: This happens in release Xcode 11 too. And happens once in a while, but restarting Xcode and simulators still helps.
EDIT 2: In Xcode 12 beta this bug is also present. But the solution is to create new StoreKit Configuration file (in File -> New menu)
Then add all your products there. Use the same product id's as in AppStore Connect.
Then add this file to Run Scheme configuration.
I had the same issue, iOS13 Simulators produced the same error, iOS12 Simulators were working well.
I then tried out on the iPhone with iOS13 installed, there the calls were working flawlessly too.
Hoping that it'll be fixed soon in Xcode Simulators, I guess until then we are stuck with the error.
Edit:
Now it seems to work also in iOS 13 Simulator Devices.
Note: I've updated the answer, read the Edit part.
To share my experience, it seems that this problem does not exist any more in Xcode 11.1 GM Seed. There's no need to restart Simulators or Xcode to make in-app purchases work anymore.
I had submitted an app for review and it was rejected because of that particular error. As it turns out, it was rejected for a stupid reason as it wasn't my app's bug, however I spent hours trying to get around it.
So, just update to Xcode 11.1 GM Seed and run again. Everything will be okay.
EDIT
The issue still exists in Xcode 11.1 and apparently I was just lucky that it didn't happen to me again. However, I had a second rejection for the exact same reason. What eventually worked and made my app get approved was this:
I had to update my IAP record on App Store by editing and saving it again.
So, I recommend you to try the same; change something temporarily in your IAPs, save and then revert your changes (and save again) so records on the App Store to be refreshed.
FYI, after the second rejection Apple invalidated my IAP and therefore showed me the way. It looks like to be a known issue to them at the end.
For details read this discussion I wrote on Reddit.
For those that has this issue in iOS 14.0, you still need to create the storekit configuration file as per #silvansky answer. Rather than adding it to the target, we can actully start an SKTestSession before making any product request in order to avoid the error.
if #available(iOS 14.0, *) {
do {
let session = try SKTestSession(configurationFileNamed: "Your_StoreKit_Configuration_File_Name")
session.disableDialogs = true
} catch {
// catch error here
}
// Start your product request here
let productIdentifiers = Set(["product_identifier_1", "product_identifier_2"])
let productsRequest = SKProductsRequest(productIdentifiers: productIdentifiers)
productsRequest.delegate = self
// Run the request
productsRequest.start()
}
You can refer to Apple's documentation for SKTestSession for more info: https://developer.apple.com/documentation/storekittest/sktestsession

WatchConnectivity connection in iPhone -> Watch direction

I'm trying to make WCSession (Xcode 7.0 beta 5) work in the Phone -> Watch direction on real devices (in a simulator it works perfectly) but every time get an error:
Error: "Domain=WCErrorDomain Code=7006 Watch app is not installed".
I mean everything works in the Watch -> Phone direction (sendMessage:, updateApplicationContext:, CoreLocation, etc.). In order to exclude code-related problems I'm using the Apple's Potloc application for tests.
It seems I've tried everything and here's a full list:
Paired/Unpaired Watch.
Rebooted iPhone/Watch.
Reset Watch.
Reset iPhone (reset all settings).
Reinstalled iPhone/Watch applications a bunch of times.
Switched on/off "Show App on Apple Watch" in "My Watch" application on iPhone.
The only way iPhone is able to communicate with Watch is to answer using a callback in WCSession methods.
What else can I do?
As expected the problem has been solved in Xcode 7.0 beta6. A project just has been rebuilt without any additional configuration and then the item #6 from my aforementioned list has solved the problem:
Switched on/off "Show App on Apple Watch" in "My Watch" application on iPhone.
This seems similar to this:
WatchOS 2 (beta 5): watchAppInstalled returns false
Did you watch out for "isWatchAppInstalled"? If yes, did it say YES or NO?
Maybe the other solutions mentioned over there work for you?

iTunes Connect trouble - 2.1 - Apps that crash will be rejected

I have created a game for iPhone in Swift (Xcode 6.4) and there is no error message in Xcode. Everything is working correctly in Simulator and also on real iPhone. Problem is after submitting the package to the iTunes Connect.
I alway get error: 2.1 - Apps that crash will be rejected.
"We were unable to review your app, as it crashed on launch. We have attached detailed crash logs to help troubleshoot this issue."
Logs:
http://a52.phobos.apple.com/us/r30/Purple1/v4/fc/77/53/fc7753f6-9d9d-991d-8c02-c1afeae66ea2/temp..ojahvbgy.crash?downloadKey3=1438984413_5da87ab807d97290498f8dbabc60dec7
and
http://a1313.phobos.apple.com/us/r30/Purple1/v4/7d/79/b2/7d79b24b-e816-0c34-8f51-d9775024c3cb/temp..dxslzkma.crash?downloadKey3=1438984413_b6f3584e263db2c6a0e387b6b725763a
I’m trying to solve my problem over the month and I have still no solution. Any idea? Thank you in advice.

Failed to open Apple Pay sheet on iPhone 6

I want to make an example project that open an Apple Pay sheet when user clicks on the 'Pay with Apple Pay' button on my app.
I test my app on an iPhone 6 with iOs version 8.1 (which contains Apple Pay) and Xcode 6.1 GM. Both of them have not been officially released yet.
I followed the tutorial on this page. And this is my code for handling the on-click event of 'Pay with Apple Pay' button:
PKPaymentRequest *request = [PKPaymentRequest new];
// Must be configured in Apple Developer Member Center
// Doesn't seem like the functionality is there yet
request.merchantIdentifier = #"my.valid.merchant.identifier";
request.countryCode = #"US";
request.currencyCode = #"USD";
// Let's go!
// if (![PKPaymentAuthorizationViewController canMakePayments]) return;
PKPaymentAuthorizationViewController *authVC = [[PKPaymentAuthorizationViewController alloc] initWithPaymentRequest:request];
authVC.delegate = self;
[self presentViewController:authVC animated:YES completion:nil];
Clicking on the 'Pay with Apple Pay' button, I got this error:
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Application tried to present a nil modal view controller on target
When checking the PKPaymentAuthorizationViewController canMakePayments], it returns false.
I'm not sure about the reason of my error is of the iPhone's setting or my code.
Does someone have the experience with Apple Pay? Please help me. Thank you so much.
I test my app on an iPhone 6 with iOs version 8.1 (which contains Apple Pay)
No, the most recent beta (iOS 8.1 Beta 2) does not contain Apple Pay. There's obviously some stuff in there under the hood as they're working on it, but it's not intended to work for developers yet.
This is why [PKPaymentAuthorizationViewController canMakePayments] returns NO and authVC is nil. Apple Pay is also not available in Settings, nor is it mentioned in the release notes.

iOS In-App Purchases invalid product identifier in ONLY iOS6

I'm trying to test In App Purchase within the sandbox environment.
And I've checked all http://troybrant.net/blog/2010/01/invalid-product-ids/ methioned.
It's my code of getting products response from APPLE SERVER.
- (void)productsRequest:(SKProductsRequest *)request didReceiveResponse:(SKProductsResponse *)response {
NSLog(#"############ REQUEST RECEIVED RESPONSE %#", response.products);
for (NSString *productID in response.invalidProductIdentifiers) {
NSLog(#"Invalid product identifier: %#", productID);
}
}
I can get all my products with iOS5.X devices. But all invalidProductIdentifiers with iOS6.x devices. I'm very confused. I have no idea about what can cause this.
It's my test results below.
I've tested in all versions of simulator, FINE
*Device *iOSVersion Result
ipod3 5.0 FINE
iphone4 5.1.1 FINE
ipod5 6.1.2 Invalid Product Identifiers
iphone5 6.1.3 Invalid Product Identifiers
anyone has some ideas? Any help is appreciated.
iOS 6 Simulator does not support testing In-App Purchase.
Please use a device to test your apps that use this feature.
Please Check This Link :
http://developer.apple.com/library/ios/#releasenotes/General/RN-iOSSDK-6_0/

Resources