1
votes

I am trying to add Firebase to my Codename One iOS app. I've read up on how to add Native Interfaces in Codename One and have successfully added the CocoaPods for Firebase as well. However, being unfamiliar with Objective-C and iOS in general (I've never worked on an iOS app outside of the Codename One framework), I'm not sure how to integrate these instructions from the Firebase website into my interface:

@import UIKit;
@import Firebase;

@implementation AppDelegate

- (BOOL)application:(UIApplication *)application
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
  [FIRApp configure];
  return YES;
}

As well as the instructions here: https://firebase.google.com/docs/analytics/ios/start?authuser=0, specifically:

Import the Firebase module in your UIApplicationDelegate subclass:

OBJECTIVE-C

@import Firebase;

Configure a FirebaseApp shared instance, typically in your application's application:didFinishLaunchingWithOptions: method:

OBJECTIVE-C

// Use Firebase library to configure APIs

[FIRApp configure];

I added the .plist file to my native -> ios folder.

EDIT: I want to use the following Firebase features: analytics and crash reporting to start with, eventually notifications.

Can someone advise how this would be done?

Thanks!

1
what you need in fire base? - Sagar Bhut
Which features of Firebase are you planning on using - authentication, realtime database, push notifications, etc. That first needs to be known before anyone can provide suggestions to point you in the right direction - Pat Needham
Thanks. Please see edited question. - Schreiby

1 Answers

0
votes

Add the build hints:

ios.afterFinishLaunching=[FIRApp configure];
ios.glAppDelegateHeader=#import <Firebase/Firebase.h>

The rest of the things you can just invoke in the native interface code. Notice the tip to wrap the code in async blocks https://www.codenameone.com/blog/tip-use-native-edt.html