iOS9 in-app purchase error code changed for user cancellation? - ios8

On iOS8, in my app (which is working fine), if the user is not logged in with their Apple Id, and they attempt an in-app purchase, they get the following Apple alert:
Now, if the user presses "Cancel",in the code, we get an error code 2 with the SKPaymentTransaction. This has the enum code SKErrorPaymentCancelled
On iOS9, in the same situation, we now get error code 0,
Error Domain=SKErrorDomain Code=0 "Cannot connect to iTunes Store"
UserInfo={NSLocalizedDescription=Cannot connect to iTunes Store}
This has enum code SKErrorUnknown, which doesn't seem useful.
Anyone else run into this? The difficult here is in my app UI. If I get an error code, SKErrorPaymentCancelled, I don't present any info to the user as it is clear that the user has explicitly done a cancellation.
With SKErrorUnknown, I can't tell what has gone on, so I present an error alert to the user. Which, if they have explicitly cancelled, is just annoying. Thoughts?

May be :
Your app is enabled only for other location, test user was localized for other - and with this setup does not work. You should enabled the app for USA and created a test user localized in USA and it seems to work (no code change at all). And I think that proves that the code is ok, just the apple sandbox has some problems with non USA test users.
And don't login from settings. When this login form comes from your app, try it.

Related

NSSharingService instance return nil in cocoa

I downloaded the sample code on NSSharingService from https://developer.apple.com/library/mac/samplecode/SharingServices/Listings/Sharing_APLAppDelegate_m.html. The code is not working as i am not able to launch mail app from this. On debugging i found that [NSSharingService sharingServiceNamed:NSSharingServiceNameComposeEmail] is always returning nil. Can someone please guide me if there is any system set up required to launch this successfully.
I had the same issue with Facebook service (NSSharingServiceNamePostOnFacebook).
It is nil when "System Preferences -> Internet Accounts -> Facebook -> Share Menu" is turned off.
A sheet appeared first time and asked to add an account, I added one and just disabled that option and had to debug a code for about an hour.
As for your issue with Mail, it should be something similar, something with Mail accounts configuration. I tried myself to disable all Mail accounts, but it picked my Gmail one, so I was not able to reproduce it. Also I have no ability yet to test with a non-configured Mail.
Hope this will help you to go in the right direction.

Azure Notification Hub Register iOS Device Always Returns Unauthorized

Early on in developing an iOS app with Xamarin, another developer and I got push notifications working for it using the Azure Messaging Component. It's a few months later now, and sometime between then and now, the push notifications stopped working. The code is still basically the same as before (which is nearly identical to the example code for the component), it was just moved to its own class for maintainability.
On Hub.UnregisterAllAsync(DeviceToken, error =>, error is:
The operation couldn’t be completed. (NSURLErrorDomain error -1012.)
On Hub.RegisterNativeAsync(DeviceToken, tags, error =>, error is:
URLRequest failed for <NSMutableURLRequest: 0x167dbd80>
{ URL: https://[our namespace].servicebus.windows.net/[our hub name]/Registrations/?$filter=deviceToken+eq+'[long token]'&api-version=2013-04 }
with status code: unauthorized
We tried a new hub, and a new namespace with a new hub, but without luck. I've rolled back the changes we've made since it was working, but with no luck there either. The same error happens on multiple devices, on multiple networks. It never shows any errors in the portal for APNS, so I'm assuming this is something with authenticating to the Hub itself. What is really weird is that a Windows Store app that we wrote to test this registers and receives notifications using the same credentials without any issue. Can anyone point me in the right direction on this? The error messages above aren't very helpful.
It turns out that the test devices all had the automatic date and time synchronization turned off. The iPad I was primarily testing with was only off by about 20 or 30 seconds, so I didn't notice it was off. Another question involving the same thing with a Windows or Windows Phone registration clued me into it, but I can't find the link to it now. Apologies for that, thanks to whoever that was!
Looking at the API, it makes sense why it's so sensitive to this. It uses the date and time to generate the SAS Token, thus the unauthorized response when the time is just a few seconds off.

In-App purchase sometimes fails with SKErrorDomain Code=0 "Unknown Error." in production

I have a Mac app that offers an In-App purchase. Once in a while I have users contacting me, because purchasing fails with the error below.
Please note that this happens for regular users. It works fine for me. (There are many questions on SO where this happens for developers with "test" user accounts, this is not the case here).
Error:
Error Domain=SKErrorDomain Code=0 "Unknown Error." UserInfo=0x7fead1e44490
{NSLocalizedDescription=Unknown Error.}
When you receive Error Domain=SKErrorDomain Code=0 “Operation could not be completed. (SKErrorDomain error 0.)” in the production environment, try the following: Make sure you have used the correct Product Identifier. If you have, after you call [SKPaymentQueue addPayment:], you will receive error 0 before you are asked to confirm payment. Create a new test user if your current test user has been invalidated. If you accidentally log in to the App Store with your test user, you will receive error 0 after entering your password to confirm the payment.
Unfortunately, there is nothing else that can be done about this error while in the production environment. This error is mainly caused by Apple, and it is an unknown error related to their API. When the issue is on Apple’s side, it's always a good idea to submit a bug report with complete information, including a sysdiagnose archive from the device.

No Suitable application record were found. When Validating Application

Okay I register my application to Itunes connect. I make sure that the correct application name and bundle is available.
Then I archieve my project and then I want to validate.
Then I got this message.
What is exactly wrong?
Is apple cannot figure out any application with the same bundle id and the same application name? Which one mismatch?
This is a common error. Just make sure that you set your app's state to waiting for upload
From Apple's documentation:
Troubleshooting: If Xcode doesn’t find an iTunes Connect application
record for your application, the “No suitable application records were
found” dialog appears. This dialog also appears when the application
record state is not at least Waiting for Upload.
When you register your app, it becomes 'Ready For Upload' first. You have to put it to 'Waiting For Upload' manually, by clicking the bottom-right button in iTunes Connect.
I'll add another answer because I just spent the last 30 minutes trying to figure out why I could not get validation to work...
If you have multiple iTunes Connect accounts, make sure you are logging in with the correct account that you created the app in iTunesConnect with.
It sounds like a no-brainer but the Organizer remembers the credentials that you last validated with for deployment. The last app I shipped was several months ago under my contractor credentials. My new app is under my own credentials but I was trying to authenticate with the saved contractor credentials. ugh.

FacebookOAuthException: Error validating access token on WP7 using Facebook C# SDK

I have a strange problem with the Facebook C# SDK on Windows Phone 7. I am using the SDK to post pictures to users' walls. For the first authentication and the first few posts, it works great. After a while (I have a feeling the magic cutoff is 24hrs) I start to get an error on every post:
FacebookOAuthException was unhandled
(OAuthException) Error validating access token.
This happens after my line of code that does the actual post has run...
m_facebook.PostAsync(#"/photos", parameters, PostComplete);
... but before my PostComplete callback function is called. No code of mine is running when the exception happens. My Application_UnhandledException is not called - I get the error in a dialog in the middle of the screen in VS, and it says that no source code is available.
If this exception means I need to show the login screen again, that's fine - right now I'm both not sure what it means and not sure how to trap the bugger. Any help appreciated.
Chris
What publishing permissions do you use?
By default, access tokens expire after a short time period to ensure applications only make requests on behalf of the user when the are actively using the application.
For getting a long-lived access token, you need to ask for the offline_access permission.

Resources