GCM : Configuring subspecs failed # CloudMessaging - ios

I am trying to integrate Google Cloud Messaging in my iOS application. I have followed every instruction provided in this link.
I have also integrated Google sign-in and it works fine.
The problem is I am getting assertion failure in the below code.
NSError* configureError;
[[GGLContext sharedInstance] configureWithError:&configureError];
NSAssert(!configureError, #"Error configuring Google services: %#", configureError);
Which is used to configure subspecs for cloud messaging.
This code above is in didFinishLaunchingWithOptions method in AppDelegate.m file.
The error generated is:
Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Error configuring Google services: Error Domain=com.google.greenhouse Code=-104 "Unable to correctly configure subspec CloudMessaging" UserInfo={NSLocalizedDescription=Unable to correctly configure subspec CloudMessaging, NSLocalizedFailureReason=GCM Sender ID must not be nil or empty.
Now I don't understand the meaning of this error. Yes, it clearly states that sender ID must not be nil. But from where it gets null ID.
I have tested this in simulator. I don't know if that affects or not.
If I comment this code and run in real device I also get the registration token but I don't receive any notification from my server. Server side code is tested and works fine for android.

Finally I solved the problem. First of all thank you all for quick reply.
What I did is explained in the following steps.
Get GCMExample project. Which I downloaded from Github because pod try google does not list GCMExample project.
Generate GoogleServices-Info.plist file from here
Compare plist files of GCMExample and MyProject.
Here I got the difference in it. In My project GCM was disabled and there was no Sender ID in it. I don't know how the hell did that happened.
So I manually set the GCM service enabled and added sender ID of my app that I previously created.
That is how I solved my problem.

Check Below Link for certificate
cloud-messaging_ios_certs
Make sure you are following below steps correctly
Create your App ID with Push Notifications ON.
Create your SSL Certificate.
Download and run it in order to be added to the Provisioning Profile.
To make sure that your provisioning profile has this certificate go to Xcode -> Preferences -> Account -> Your Apple ID -> Your Team -> View Details -> Download All.

Related

API key not valid Kudan (AR) xcode

I'm a beginner to Unity and try to make a simple AR app (IOS). I followed some tutorials and faced a problem. I set the API key and BundleID in Unity correct and changed the "enable Bitcode" to NO. When I want to build & run the application I got the message:
Failed to code sign "Unity-iPhone"
"Fix Issue" the following message:
An App ID with Identifier 'eu.kudan.ar' is not available
When I change the Bundle Identifier to my own team and app name the 'obstacle' seems to be fixed. When the build is ready and the application starts (on the device) the following error occured:
Kudan.AR.KudanTracker:Start()
[ line 374]
(Filename: Line: 374)
2016-08-27 02:56:06.005 ar[633:164754] Error verifying license key for bundleID: eu.bart.CarAR error: (null)
2016-08-27 02:56:06.005 ar[633:164754] API key not valid
What am i doing wrong?
thanks!
You can maybe try with another key.
https://wiki.kudan.eu/Development_License_Keys
And it's normal if it doesn't work with own app name.

How to fix Failed to fetch default token error?

I am getting this error after installing in iphone.
Using Xcode8, the fix was to simply enable Keychain Sharing in Capabilities
Open the app.xcworkspace file, select Target > Capabilities > Enable 'Keychain sharing'
Possible reasons for this issue:
Device date was not set to the current date.
Bundle ID is not same that one you set in GoogleService-Info.
.p12 certificate uploaded on Firebase Console is not correct.
Make sure that:
Bundle ID is the same that one you set in GoogleService-Info
Code signing params (Target => Build Settings => Code signing) are corrects and match with p12 cert file you've set in Firebase.
Also, you have to follow those tutos:
Notification: https://firebase.google.com/docs/notifications/ios/console-audience
Configuration: https://firebase.google.com/docs/ios/setup
And don't forget to ask permission to user simply to add that in your app (In AppDelegate file, or in other ViewController for example):
let notificationTypes: UIUserNotificationType = [UIUserNotificationType.Alert, UIUserNotificationType.Badge, UIUserNotificationType.Sound]
let pushNotificationSettings = UIUserNotificationSettings(forTypes: notificationTypes, categories: nil)
application.registerUserNotificationSettings(pushNotificationSettings)
application.registerForRemoteNotifications()
i have same issue
failed to fetch default token error domain=com.firebase.iid code=501
today spend 4 hours on this
and finally got issue and thats
my iphone time is wrong (manually i set diff time for testing)
so once check time when you have request firebase token.
Make sure you uploaded Development APNs certificate to Firebase. Go to Settings of your project => CLOUD MESSAGING tab.
Have been stuck for a while with this, for me the reason why I could not make it work was that I was using a secondary firebase app.
It looks like a bug to me.
As a workaround, I had to initialize the additional app before the default app (in AppDelegate.m):
//initialise the secondary app, for example:
NSString *logFirebaseOptionFile = [[NSBundle mainBundle] pathForResource:#"GoogleService-LOG-Info" ofType:#"plist"];
FIROptions *firebaseOptions = [[FIROptions alloc] initWithContentsOfFile:logFirebaseOptionFile];
NSString *logAppName = #"mybands_logs";
[FIRApp configureWithName:logAppName options:firebaseOptions];
//then the default app for FCM to work
[FIRApp configure];
Well, I also got this same problem. Can't fix it using solutions introduced by other posts. It seems that the communication between your client App FCM SDK and the FCM server goes wrong.
My fix was I loginned to my VPN (mainland China can't use google service if you don't do this). Then I could get the firebase token.
Besides, if you failed to get the token. Next time you try to access the firebase token using [[FIRInstanceID instanceID] token]. Firebase SDK will try to fetch the token again if it's still nil, and if this attempt succeeds, the token refresh notification (kFIRInstanceIDTokenRefreshNotification) will be posted.
You have to fix this line before handling this error:
Failed to fetch default token Error Domain=com.firebase.iid Code=0 "(null)"
Here is an answer to fix this issue
Go to Signing & Capabilities And Add Push Notification Capability

'Open this page in "null"' Modal appearing from FacebookSDK login after iOS9 and Swift 2 upgrade

I'm in the process of updating projects to Swift 2 and iOS 9. One of the projects I'm doing relies heavily on Facebooks SDK. I use it to login, get user information, ect... Prior ot the update, once you logged in the Safari would redirect you directly to the app. Now I'm getting a fun little modal displaying the following (See Fig 1 at bottom)
I assume this has some connection to the new Info.plist key we add LSApplicationQueriesSchemes with a Item0 as fbauth2 now required by iOS 9.
I also noticed I'm getting a stack trace with my app saying:
failed for URL: "fbauth2:///" - error: "(null)"
I found the reoccurence of the new key data fbauth2 interesting, and I'm assuming that there is now a way to configure what this modal will say upon redirect. Does anyone have any idea how to configure this? I'm assuming this is a common issue for all those updating their apps. Thanks!
Fig 1
Make sure that you have updated to the newest version of the Facebook SDK at http://fb.me/FacebookSDKs-iOS-20150910.zip.
You will also want to Whitelist the Facebook Servers for Network Requests.
More information on this can be found here.
Specifically look at steps #2 & #3.
From the documentation in Step #3 there were also changes to the canOpenURL method:
Why do I see console messages like 'canOpenURL: failed for URL: "fb...://' or ?
This is an Xcode warning indicating the the canOpenURL: call returned false. As long as you have configured the LSApplicationQueriesSchemes entry in your plist as described above, you can ignore this warning

App is crashing while using Google Sign in for iOS with AssertionFailure

I tried to implement Google Sign in for iOS according to the docs - iOS implentation. But the app is crashing with an error while calling
[[GGLContext sharedInstance] configureWithError: &configureError];
in my App Delegate's application:didFinishLaunchingWithOptions method.
Error :-
Assertion failure in void validateGoogleSignInWithURLSchemes(NSArray *__strong)(), googlemac/iPhone/Greenhouse/Source/GGLURLSchemeUtil.m:39
I have added GoogleService-Info.plist to the target resources and also added URL Types for REVERSED_CLIENT_ID and Bundle Identifier as explained in the docs and also referenced here.
Is there something I am missing or what should I do to fix the same?
It was due to a simple spelling mistake. I had my Bundle Identifier wrong in the URL scheme while adding URL Types.
Please suggest if it's better to delete this question. I will delete the same.

GooglePlus Login fail :The operation couldn’t be completed. (com.google.HTTPStatus error 400.)

I'm using Google Play Game Services Prime31 Unity Plugin for my Unity - IOS project. After I import Unity package and build for IOS, I'm not getting build error on Xcode. However, at runtime, when I try Google+ sign in I am getting this error:
"GooglePlus Login fail :The operation couldn’t be completed. (com.google.HTTPStatus error 400.)"
When i press sign in button, choice of google account screen is displayed but after i choose an account, it returns without signing in(following cancel-OK screen is not displayed) and gives the error that I've quoted.
At Unity I've used init method where I passed clientID(which is surely called before auth method) and I set Info.plist additions properly. When I press sign in button PlayGameServices.authenticate() is called. Should I add some other method or sth at Xcode? How can I solve the problem? Thanks in advance.
u test ur app in iOS 8?? I using another google play service plugin and also getting this error when running in iOS 8. But my app is work well in iOS 7.
Cause of issue :
Cause 1: May be bundle id of google console and your application is not matching .(application bundle id and google console bundle id should be same).
Solution : Steps
a: GoTo google console and login with your application google account .
for finding key :: open google console > select your project > API & Auth > Credential
b: change bundle id and regenerate key .
c: replace previous key with your new generated key .
[GMSServices provideAPIKey:#"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"];
Cause 2: May be key is not matching with you google console key .
Solution: Just replace your application key with google console key .
[GMSServices provideAPIKey:#"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"];
Note: Make sure your application bundle id and google console bundle id is same .

Resources