EXC_BAD_ACCESS with GCM 3.0 - ios

I'm trying to integrate GCM v3 into a cocos2d-x v3.6 project, and after a few days of getting things working with CocoaPods and Xcode, I finally was able to build the app. However, when deployed on device for testing, it crashes on calling [[GGLInstanceID sharedInstance] tokenWithAuthorizedEntity:_gcmSenderID scope:kGGLInstanceIDScopeGCM options:_registrationOptions handler:_registrationHandler] with the error EXC_BAD_ACCESS. What gives?
Screenshot: http://i.imgur.com/s0HnxTp.png
My configuration is as follows:
daffodilistic$ pod --version
0.39.0.beta.4
daffodilistic$ cat Podfile
platform :ios, '8.1'
source 'https://github.com/CocoaPods/Specs.git'
target 'project-redacted iOS' do
pod 'Google/CloudMessaging'
end
target 'project-redacted Mac' do
end

I managed to debug and resolve the exception successfully - apparently, it's caused by a NULL or 0x00000000 value being pointed to by the #property(nonatomic, retain) void (^registrationHandler) block property declared earlier on as per Google's sample GCM v3 code for iOS. As to whether it was Xcode, iOS or cocos2d-x causing the block declaration to be dereferenced/deallocated, I'm not sure.
The solution was to move the (^registrationHandler) block declaration from
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
to
- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken
Related SO link which was useful, but not really crucial: unable to register (com.google.iid error 1005.)

Related

Issues setting up Firebase SDK with Unity iOS

I am a Unity game developer and know very little about app side code, so forgive me if I'm doing something stupid.
I'm trying to set up Firebase to work in my Unity iOS app. I'm in the very first setup, trying to get the SDK working.
So Firebase has you do a couple steps, and then they want you to do some initialization in your App Delegate. They want you to add two lines, an import and a configure. This is the code from their setup section.
#import UIKit;
#import Firebase;
#implementation AppDelegate
- (BOOL)application:(UIApplication *)application
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[FIRApp configure];
return YES;
}
So Unity doesn't actually use a traditional AppDelegate. I went sleuthing and found this guy's work. He basically shows how to use a standard Unity Plugin to override the app delegate. So I put the following code in my Plugins folder.
#import "UnityAppController.h"
#import Firebase;
#interface OverrideAppDelegate : UnityAppController
#end
IMPL_APP_CONTROLLER_SUBCLASS(OverrideAppDelegate)
#implementation OverrideAppDelegate
-(BOOL)application:(UIApplication*) application didFinishLaunchingWithOptions:(NSDictionary*) options
{
NSLog(#"[OverrideAppDelegate application:%# didFinishLaunchingWithOptions:%#]", application, options);
[FIRApp configure];
return [super application:application didFinishLaunchingWithOptions:options];
}
#end
Now. I'm pretty sure the Plugin is working because I can find it in my XCode project, and when I was screwing around with it and had two instances of [FIRApp configure]; it actually crashed with an error basically saying, "don't configure twice". But Firebase has not received anything from my app. They have a little prompt that says, "Checking if the app has communicated with our servers. You may need to uninstall and reinstall your app." I've uninstalled, reinstalled, tried their whole installation process again, and still nothing.
Any thoughts?? Thanks ahead of time.
If you're developing an app in Unity you can use the Firebase for Unity plugin rather than implementing your own iOS solution. Try adding Analytics to your app with this guide.

Deep linking callback issues in iOS11

I have implemented deep linking in my app using URL schema which is working properly in all versions of iOS except 11. The issue is when I load AppURLSchema:// in the device browser it launches the app but none of the appDelegate methods gets called to get the deep linking URL so that I can perform deep linking so that user will be able to see different content based upon the URL.
None of the following functions are getting called:
-(BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options
-(BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url
-(BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation
This is not an issue on iOS 10, it seems to have been introduced in iOS 11.
Any help will be appreciated.
Thanks!!
I'm facing the same problem and I discovered that the SDK Firebase integrated in my app is blocking the following callback: application:openURL:options.
Without configuring Firebase, all is working ok.
It's not just Configuring Firebase SDK causing this issue. With Firebase SDK it's working fine but There is Localytics SDK also integrated in my app and there is some conflict between FIREBASE and LOCALYTICS SDKs due to which my app was not getting the callback.
So I just removed Firebase framework based upon the priority and everything started working fine.
As mentioned in Localytics Documentation, integrations for both platforms can lead to conflicts, particularly around the handling of deeplinks.
You can prevent Firebase from swizzling the methods in your AppDelegate by adding FirebaseAppDelegateProxyEnabled set to NO in your app's info.plist as described in Firebase documentation.

objective-c Fbric crashlytics "Hmmm, seems like your kit isn't activating."

trying to install Fabric Crashlytics on my Cordova project
I followed all the steps and installing all rquired steps with building the project , but at the final step i got stuck there without any action
here is my AppDelegate.h
#import "AppDelegate.h"
#import <Fabric/Fabric.h>
#import <Crashlytics/Crashlytics.h>
#implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[Fabric with:#[[Crashlytics class]]];
return YES;
}
#end
after I build the project it's stuck there without any action
^^ this screen waits for 1 minute then it's cahnged to
I checked the info.plist and seems good without any problem
Mike from Fabric here. We don't have support for Cordova based projects. We need to see a build and run of your app with Fabric enabled. I'd recommend a clean, build and run with Fabric enabled on a device to see if that helps.

Kit info missing for Crashlytics kit xcode

I tried to integrate Fabric in iOS project. I followed the steps from the tutorial:
Add a run script Build Phase
In AppDelegate.m
Implementation:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[Fabric with:#[CrashlyticsKit]];
return YES;
}
Run project
However at last check application crashes:
Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Kit info missing for Crashlytics kit'
What is wrong?
You probably already imported these files, but for future readers, you should also have in AppDelegate.m:
#import <Fabric/Fabric.h>
#import <Crashlytics/Crashlytics.h>
You should also have Fabric.framework and Crashlytics.framework in your Frameworks (project -> target -> link phases -> link binary with libraries).
You should also have Fabric RunScript in Link Phases:
./app/path/Fabric.framework/run key1 key2
If you followed Fabric.app tutorial, you should have all these steps configured. Did you follow it? Fo you have all above items?

Parse Facebook Login not executed, PFDateFormatter unrecognized selector

I am building an iOS application with Parse. However when I try to log in with facebook I get the following error in the log:
[PFDateFormatter preciseStringFromDate:]: unrecognized selector sent to class 0x101da7628
The app doesn't crash, but the login just never gets executed.
It's funny because I have the exact same code for the login in another app, where it is working just fine. I triple checked all the included frameworks, my plist info for the facebook app, updated everything but still the same error.
I of course have included [PFFacebookUtils initializeFacebook] in my AppDelegate.m file and also implemented the required method
- (BOOL)application:(UIApplication *)application
openURL:(NSURL *)url
sourceApplication:(NSString *)sourceApplication
annotation:(id)annotation {
return [FBAppCall handleOpenURL:url
sourceApplication:sourceApplication
withSession:[PFFacebookUtils session]];
}
as well as
- (void)applicationDidBecomeActive:(UIApplication *)application {
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
[FBAppCall handleDidBecomeActiveWithSession:[PFFacebookUtils session]];
}
Does anybody have an idea on what might be causing this?
I fixed this issue by making sure I had the latest version of ParseFacebookUtils framework. For some reason Cocoapods was not updating to the most recent version, maybe it was the order that I ordered the pods in? I had to uninstall the pertinent pods and then reinstall them for it to work. Here is what my podfile looks like now:
pod 'Facebook-iOS-SDK'
pod 'Parse'
pod 'ParseFacebookUtils'
The pod install terminal output looks like this:
Using Bolts (1.1.3)
Using Facebook-iOS-SDK (3.22.0)
Installing Parse (1.6.2)
Installing ParseFacebookUtils (1.6.2)

Resources