GPPSignIn error invalid_grant / Token has been revoked - ios

Following this question:
GPP iOS not refreshing token
So I correctly receive refresh token, if I use the app for some time. The problem is that if I put the app in background for some hours (more than 3-4 hours as I noticed), next time when I trySilentAuthentication, it returns following error:
Error Domain=com.google.HTTPStatus Code=400
"The operation couldn’t be completed. (com.google.HTTPStatus error 400.)"
UserInfo=0x7feefbfa4cd0 {
json={ error = "invalid_grant";
"error_description" = "Token has been revoked."; }
I must specify that nobody manually revoked the token or anything else done manually.
What's even more strange is that sometimes after receiving this error, if I terminate the app, and then open it again and run trySilentAuthentication, it's working, and a new token is correctly generated, though sometimes won't work.
Is there anything else I need to do, like showing the consent screen again? This would be much unpleasant for user, to see that screen each day.
Any help is greatly appreciated.

Related

How does one properly test within the sandbox for apple in-app purchases?

I have a brand new app, has not been published yet. I added an in-app purchase to the code, went through the process of adding the product to the app in "app store connect", and added a sandbox user there as well.
To test, I plug in my phone to the mac, and from xcode (13.3.1) I run the app on my phone. The app runs, and I see the product show up in the app. When I hit the button to "buy", I immediately get a dialog to enter credentials. I enter the sandbox credentials, then get another alert saying "Apple ID verification, open settings to continue signing in with.."
I do that, then it pops up a 2-factor dialog saying a code has been sent, but the dialog just goes away after the code is sent via sms to that same device. There's no place to enter that code, as if it knew "oh, the code is being sent to the device that wants it". After a couple of seconds, I end up in Settings->App store, and I don't see anything useful there.
I then go back to the app, and w/o doing anything in the app I immediately get messages in the debug console:
Payment Queue Error: Optional(Error Domain=SKErrorDomain Code=0 "An unknown error occurred" UserInfo={NSLocalizedDescription=An unknown error occurred, NSUnderlyingError=0x28160ee80 {Error Domain=ASDErrorDomain Code=500 "Unhandled exception" UserInfo={NSUnderlyingError=0x2816dc150 {Error Domain=AMSErrorDomain Code=100 "Authentication Failed" UserInfo={NSMultipleUnderlyingErrorsKey=(
"Error Domain=AMSErrorDomain Code=2 \"An unknown error occurred. Please try again.\" UserInfo={NSLocalizedDescription=An unknown error occurred. Please try again.}",
"Error Domain=AMSServerErrorDomain Code=-5000 \"(null)\" UserInfo={failureType=-5000, m-allowed=false, pings=(\n), cancel-purchase-batch=true, customerMessage=The Apple\U00a0ID you entered couldn\U2019t be found or your password was incorrect. Please try again.}"
), NSLocalizedDescription=Authentication Failed, NSLocalizedFailureReason=The authentication failed.}}, NSLocalizedFailureReason=An unknown error occurred, NSLocalizedDescription=Unhandled exception}}})
I know the account credentials are correct (tried several times and verified them). It's almost as if I'm not really hitting the "sandbox" user db, more like production. But everything I read says I should be in development mode when I run things like this (based on What is a "development-signed version" of an iOS app? How do I run a development-signed version of my app?)
Is there some more precise way of determining whether or not I'm in development mode? Maybe some setting got tweaked or something.
Sorry, my bad. I had created the test account in the "regular user" section, not the "sandbox user" section up at "App store connect" (that's why I was getting the auth errors).
Things work fine with a real sandbox tester account.

iOS/RestKit - request timed out

My iOS app use RestKit framework for implementing RESTful web services client.
Sometimes, I have a problem when I call my server from my application.
The request is not sent and it fails at the end of the expiration with this error:
Error Domain=NSURLErrorDomain Code=-1001 "The request timed out."
At the first openning, it is impossible to reproduce this.
The problem occurs when the application is put into the background and it restarts 10 minutes later or more (it does not produce every time). At this point, there is no server side call .
Then, the only way to solve this problem is to force-quit the application.
We checked there is no error of url, of header, etc ...
HELP ME :'(
Try to set time interval like
[manager.requestSerializer setTimeoutInterval:yourTimeInterval];

"Error Domain=com.google.iid Code=501" while registering ios devicetoken in gcm

GLInstanceID | Unable to find token in cache Error Domain=com.google.iid Code=-25300 "The operation couldn’t be completed. (com.google.iid error -25300.).
Please get me out of this.
The error log message GLInstanceID | Unable to find token in cache Error Domain=com.google.iid Code=-25300 is traced often, both when receiving google token succeeds or fails. I assume this is not an actual error.
I started receiving the error Error Domain=com.google.iid Code=501 on one device. No matter how many times I retried the call to tokenWithAuthorizedEntity:scope:options:handler: it always returned 501. I tried deleting the app, I tried restarting the device with no luck. I noticed that the same code ran fine on other devices. As a final resort I reset all data and settings on the device (factory reset) and this fixed the problem for me.

Error creating reminder using EventKit

I have an app that uses EventKit. I ask for permission for reminders and then I have code that creates a reminder. I sometimes get this error message in my logs when running the app in the simulator:
Error getting changed object IDs since timestamp 450512391.766620 from daemon: Error Domain=EKCADErrorDomain Code=1013 "The operation couldn’t be completed. (EKCADErrorDomain error 1013.)"
Error getting default calendar for new reminders: Error Domain=EKCADErrorDomain Code=1013 "The operation couldn’t be completed. (EKCADErrorDomain error 1013.)"
The first error comes from the authorization step and second comes from these lines:
EKReminder *reminder = [EKReminder reminderWithEventStore:eventStore];
reminder.calendar = eventStore.defaultCalendarForNewReminders;
This happens after requestAccessToEntityType:completion: returns granted permission for reminders, so there is definitely permission.
The weird thing is, once the issue happens if I just restart the app everything is fine. If I reset the simulator and rerun the app this only sometimes will happen again.
This seems to only happen with the following workflow:
Reset All Contact and Settings Menu Option.
Quit simulator right away when it comes back up.
Run your app which immediately asks for Calendar info on the just-reset, never-opened-before simulator.
I suspect the reason is because when you reset the entire simulator, it needs a few seconds to initialize all the demo data such as the contacts and calendar events when it "boots" for the first time.
If you wait 10+ seconds after reset, THEN run your app, you do not get this warning.
Another workaround is to use the "Reset Privacy Settings" in iOS Simulator Settings App (General > Reset) during testing of calendar permission testing.

iOS6.1 Facebook Error validating access token: Session has expired at unix time

I have just updated to iOS6.1 and am getting this error.
error : Error Domain=com.facebook.sdk Code=5 "The operation couldn’t be completed. (com.facebook.sdk error 5.)" UserInfo=0x1ed55780 {com.facebook.sdk:ParsedJSONResponseKey={
body = {
error = {
code = 190;
"error_subcode" = 463;
message = "Error validating access token: Session has expired at unix time 1360246752. The current unix time is 1360587404.";
type = OAuthException;
};
};
code = 400;
}, com.facebook.sdk:HTTPStatusCode=400}
I have not had any of this expired session errors before. I have Facebook SDK 3.1.1 and am building to iOS 6.1 . I am catching this error but am not sure if there is a step to renew the session. Wasn't this fixed with Facebook iOS SDK 3.1.1 ? I did upgrade the Facebook app just in case.
I am handling a session closing the session:
- (void)applicationWillTerminate:(UIApplication *)application
{
// Saves changes in the application's managed object context before the application terminates.
// close notification in order to do cleanup
[FBSession.activeSession close];
Any ideas stackoverflow Lords? Thanks in advance.
Note: I have tried to force the session to close and clear the session data to use:
[FBSession.activeSession closeAndClearTokenInformation];
Without any change to the expired session. It is just not making a new session.
I hacked/solved this through turning off permission to use Facebook for this app in the iOS Settings > Facebook.
Then I built the app in xcode to force that error related to settings permissions. Turn on permissions then built it again and it ran swell.
But it seems a hack to do this an I am concerned that is might happen once the app is published.

Resources