I have a weird issue where I receive the following error only on an ipad device:
The operation couldn’t be completed. (com.google.iid error 501.)
During the GCM registration process to request a gcm token. i.e.
GGLInstanceID.sharedInstance().tokenWithAuthorizedEntity(gcmSenderID,
scope: kGGLInstanceIDScopeGCM,
options: gcmRegistrationOptions,
handler: gcmRegistrationHandler)
I'm following the example to the letter. The same process works just fine on an iphone. I'm not sure what the difference between the two devices are and why GCM refuses to register on the ipad. Both devices are currently running iOS 9.3.1.
The header file indicates that this error corresponds to:
// Device seems to be missing a valid deviceID. Cannot
// authenticate device requests.
kGGLInstanceIDOperationErrorCodeMissingDeviceID = 501,
However, I'm not sure exactly what that means. Why would the iPad be missing a deviceID, but the iphone is OK?
If anyone has any ideas on why this is happening and can share some insight, I'd greatly appreciate it.
Thanks!
In the end we transitioned to Firebase as recommended by Google recently. Everything worked as expected.
Related
I'm writing an cross-platform app with Flutter and Firebase. I've been working on sending notifications, and it works perfectly on android. I send messages via the firebase admin functions sdk with no problems. The request looks like this:
const payload = {
notification: {
title: title,
body: body,
},
}
return admin.messaging().sendToDevice(tokens, payload, {
mutableContent: true,
contentAvailable: true,
apnsPushType: "background",
})
But when I try to send messages to iOS devices, I get the following error from the shell:
"error": {
"errorInfo": {
"code": "messaging/third-party-auth-error",
"message": "A message targeted to an iOS device could not be sent
the required APNs SSL certificate was not uploaded or
has expired. Check the validity of your development and
production certificates."
},
"codePrefix": "messaging"
}
I was under the impression that since I'm using a APNs key generated in the apple developer console, that I would not need any sort of SSL certificate. My key is uploaded to the Firebase console and iOS devices are successfully reporting their device tokens, so I'm not sure why I can't get a message through.
I've tried sending messages from the CLI and also from the FCM console online. Both have failed.
I've also enabled Push Notifications and Background Modes with background fetch and remote notifications.
Any help or suggestions would be appreciated.
This is really stupid, but the issue was an incorrect Bundle ID in firebase. When I first hooked up firebase it gave me a default bundle id (com.firebase.io or something dumb like that). Later when I actually put my app on testflight i called it something else entirely. So even though I followed all the directions on the FlutterFire website for setting up apple here it didn't work bc the bundle ids didn't match.
So I had to delete the firebase app, replace the googleservicesinfo.plist file (thought it might have been sufficient to just change the bundle id field in that file (idk for sure tho)) and then replaced it in the firbase console. Had to reupload the auth key too with the "new" app.
Hope that makes sense. Comment if you have any other questions!
Today may production app started having issues on Phone Authentication through Firebase on several devices (but not all).
When I make the call PhoneAuthProvider.provider().verifyPhoneNumber(phoneNumber: uiDelegate:) I get the following error:
Error Domain=FIRAuthErrorDomain Code=17048 "Invalid token." UserInfo={NSLocalizedDescription=Invalid token., error_name=INVALID_APP_CREDENTIAL
As per Firebase documentation, this code indicates that an invalid APNS device token was used in the verifyClient request.
Nothing in my app code has changed, yet this error is occurring. I uploaded a new APNs Key and .p8 file as other StackOverflow posts have suggested, with no luck.
I have tried the suggestions in this similar post.
I am also able to receive push notifications from my app to this device, so it isn't like my push notifications aren't working.
Could anyone suggest ways of debugging his?
Edit: This is the method I am calling:
func sendVerificationCode(to phoneNumber: String, _ completion: #escaping (Error?)->Void) {
PhoneAuthProvider.provider().verifyPhoneNumber(phoneNumber, uiDelegate: nil) { (verificationID, error) in
/* store verificationID locally if exists */
completion(error)
}
}
firebaser here
There was an issue where iOS clients were not receiving the text messages required for one-time password authentication. Its status is being tracked here: https://status.firebase.google.com/incident/Authentication/18006
From there:
We are investigating an issue with Firebase Phone authentication that affects iOS devices. Affected customers may see "invalid token" error during OTP verification.
This issue has been fixed, since 11:15 am pacific time. If you're still seeing similar problems, reach out to Firebase support for personalized help in troubleshooting.
I'm using the iOS LinkedIn SDK to log into my App and retrieve basic profiles.
All works perfectly fine the first time I login, until either I log out, or I close my App.
On attempting to log back into my App with LinkedIn: the usual redirect to the LinkedIn app takes place, but the permissions screen for my app doesn't pop up, it just redirects straight back to my app with the following error:
Error Domain=LISDKAuthError Code=5 "(null)" UserInfo={errorDescription=The operation couldn’t be completed. Software caused connection abort, originalDomain=LISDKServerError, errorInfo=PARSING_ERROR}
I can only successfully log back in again if I first close the LinkedIn App, before reopening mine.
Does anyone have an idea of what's going on please?
-This doesn't occur on all of my test devices!
-On the device that it does occur on, I also receive the same error in that scenario when running the sample App provided with the LinkedIn SDK.
-The LinkedIn App is up to date.
-The App id, bundle ids etc etc are all set, hence login success half of the time!
-I've tried calling [LISDKSessionManager clearSession] in numerous locations.
Cheeky framework fix alert.
Uncomment out the lines in LISDKSession.h
This allows the correct use of [LISDKSessionManager hasValidSession]
Which is an improvement on what we were working with.
Not yet tested with iOS12...
I had a similar problem. It was mainly reproduced only on iOS 12. The problem is that when you already have a LinkedIn application running, you will not be able to log in through their SDK in your application. On iOS 11, the second time you try to log in after this error, the authorization worked fine.
I solved this issue by simply showing the user an alert with a message about what he needs to do to authorize.
Here you can check an example of my implementation in Swift 4:
LISDKSessionManager.createSession(withAuth: ["r_basicprofile"],
state: nil,
showGoToAppStoreDialog: true,
successBlock: { _ in
// Your actions in case of successful authorization
}, errorBlock: { error in
guard let nsError = error as NSError? else {
return
}
if #available(iOS 12.0, *),
nsError.code == LISDKErrorCode.SERVER_ERROR.rawValue {
// Show alert to user with text - "Please, shut down the LinkedIn app and try login again"
} else if nsError.code != LISDKErrorCode.USER_CANCELLED.rawValue {
// Handling when user tap on Cancel button in LinkedIn SDK
}
})
I've been battling for a fix for this with LinkedIn for months.
There 'solution' is to kill off the SDK.
Taken from their 'Important updates to the LinkedIn Developers program and APIs' email December 2018:
"Authentication, SDKs, and Plugins: We are also deprecating several obsolete or seldomly-used products and technologies."
"SDKs: Our JavaScript and Mobile Software Development Kits (SDKs) will stop working. Developers will need to migrate to using OAuth 2.0 directly from their apps."
Uncomment this two lines of code in LISDKSession.h
- (LISDKAccessToken *)getAccessToken;
- (void)setAccessToken:(LISDKAccessToken *)accessToken;
What I have done:
I have created a simple iOS native App which has nothing but OneSignal initializaion codes. I installed my App on my 2 devices, device A and device B. Both devices are subscribed to my OneSignal App Console. When I send a notification from OneSignal Web Console, the 2 devices can both recive the notification.
What I want to do:
When I click on a button on device A, device A will send a notification to device B.
What is the problem:
I followed the OneSignal iOS SDK document and created the following function
https://documentation.onesignal.com/docs/ios-native-sdk#section-sending-notifications
func onButtonClick() {
OneSignal.postNotification(
[
"contents": ["en": "Test Message"],
"include_player_ids": ["c00bb8a6-79da-419b-9999-e919831a5223"] // id of device B
],
onSuccess: {(result) in print("success") },
onFailure: {(error) in print("error : \(error)") }
)
}
however, when I clicked the button, an error shows up in the xCode debug console:
2017-01-20 11:15:52.702852 my.bundle.id[2263:1201122] ERROR: Create notification failed
error : Optional(Error Domain=OneSignalError Code=400 "(null)" UserInfo={returned={
errors = (
"Please include a case-sensitive header of Authorization: Basic <YOUR-REST-API-KEY-HERE> with a valid REST API key."
);
reference = (
"https://documentation.onesignal.com/docs/accounts-and-keys#section-keys-ids"
);
}})
I was confused, because according to the OneSignal Reference document, send notification with "include_player_ids" Does not require API Auth Key.
https://documentation.onesignal.com/reference#create-notification
And it also says: NEVER use your 'REST API key' in client code, it is intended for use on your system or server only.
So what does this error mean? And what should I do?
I even copied and run this "work without any problems" code from this discussion, but the same Authorization error still shows up. What am I doing wrong?
The Answer
Just upgrade the SDK and the problem will be gone.
This was a bug in OneSignal-iOS-SDK 2.3.1, this bug was fixed in 2.3.2.
Please see their Github Release Notes.
How to avoid this kind of problems
Always run pod repo update before pod install to ensure that the pod install the latest version of the frameworks.
Thanks Kevin, Jason and Josh from One Signal Conversations to help me solve this problem.
I'm not sure if this is an issue of the library or something wrong on our side but I already spent a lot of time searching about this and found nothing that could shed any light.
We're using GCM since a while on both iOS and Android. The application is in production and is working fine. Our iOS app collects and reports low-impact errors (basically errors we catch and handle) and analyzing these data I found those errors I'm struggling to understand.
While registering a device on GCM with an APNS token
Error Domain=com.google.iid Code=1006 "(null)" that according to the documentation is kGGLInstanceIDOperationErrorCodeInvalidKeyPair
While subscribing to a topic
Error Domain=com.google.gcm Code=501 "(null)" that according to the documentation is kGGLInstanceIDOperationErrorCodeMissingDeviceID
Both errors happens on iOS8/iOS9/iOS10.
Our app includes the GCM library via Cocoapods:
pod 'Google/CloudMessaging', '2.0.4'
Can someone help me understanding what's happening?
Thanks!
The first error kGGLInstanceIDOperationErrorCodeInvalidKeyPair means that you have error in KeyPair access. While the error kGGLInstanceIDOperationErrorCodeMissingDeviceID means that your device seems to be missing a valid deviceID. It cannot authenticate device requests. From this related thread, error code 501 was solved by resetting all data and settings on the device (factory reset) and this fixed the problem. It's also stated here that the error occurred maybe because you are calling GCMService.sharedInstance().connectWithHandler() { error in if(error != nil) { print(error) } } before you had received a registration token, or had failed to refresh your token.
But I found this SO question which have similar issue with you which suggests to transition to Firebase Cloud Messaging as recommended by Google and his issue was solved.