Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Firebase/Core Problems #12

Open
perexlautaro opened this issue Jan 15, 2019 · 6 comments
Open

Firebase/Core Problems #12

perexlautaro opened this issue Jan 15, 2019 · 6 comments

Comments

@perexlautaro
Copy link

Expected Behavior

Work and compile in ios like in android.

Actual Behavior

  • Adding the plugin: ionic cordova plugin add cordova-plugin-firestore --save --variable ANDROID_FIREBASE_CORE_VERSION=+ --variable ANDROID_FIREBASE_FIRESTORE_VERSION=17.1.0
  • Compile: ionic cordova build ios
  • Then open .xcworkspace in xcode and run in real device, I get the following error:
Undefined symbols for architecture arm64:
  "_OBJC_CLASS_$_FIRAppEnvironmentUtil", referenced from:
      objc-class-ref in FirebaseCoreDiagnostics(FIRDiagnostics_5fae2e67e4a7b4383df55126bc52c2ef.o)
      objc-class-ref in FirebaseRemoteConfig(RCNConfigSettings_4abc67fd6e9bdbafa6d0943a83af1eeb.o)
      objc-class-ref in FirebaseRemoteConfig(RCNDevice_2fa242eb4aad3e3bff10c6bde66c21bf.o)
  "_kFIRNetworkHTTPStatusCodeNotModified", referenced from:
      -[FIRAMeasurement networkRemoteConfigFetchCompletionHandler:data:error:] in FirebaseAnalytics(FIRAMeasurement_78431add5886f7a64f080bb6c3f99898.o)
  "_kFIRNetworkHTTPStatusCodeNotFound", referenced from:
      -[FIRAMeasurement networkRemoteConfigFetchCompletionHandler:data:error:] in FirebaseAnalytics(FIRAMeasurement_78431add5886f7a64f080bb6c3f99898.o)
  "_kFIRNetworkHTTPStatusOK", referenced from:
      -[FIRAMeasurement networkUploadCompletionHandlerWithResponse:error:] in FirebaseAnalytics(FIRAMeasurement_78431add5886f7a64f080bb6c3f99898.o)
      -[FIRAMeasurement networkRemoteConfigFetchCompletionHandler:data:error:] in FirebaseAnalytics(FIRAMeasurement_78431add5886f7a64f080bb6c3f99898.o)
  "_OBJC_CLASS_$_FIRReachabilityChecker", referenced from:
      objc-class-ref in FirebaseMessaging(FIRMessaging_19f9b855665683fa3c0a0daa7f2a8036.o)
  "_kFIRNetworkHTTPStatusNoContent", referenced from:
      -[FIRAMeasurement networkUploadCompletionHandlerWithResponse:error:] in FirebaseAnalytics(FIRAMeasurement_78431add5886f7a64f080bb6c3f99898.o)
      -[FIRAMeasurement networkRemoteConfigFetchCompletionHandler:data:error:] in FirebaseAnalytics(FIRAMeasurement_78431add5886f7a64f080bb6c3f99898.o)
  "_kFIRNetworkHTTPStatusCodeUnavailable", referenced from:
      -[FIRAMeasurement networkUploadCompletionHandlerWithResponse:error:] in FirebaseAnalytics(FIRAMeasurement_78431add5886f7a64f080bb6c3f99898.o)
      -[FIRAMeasurement networkRemoteConfigFetchCompletionHandler:data:error:] in FirebaseAnalytics(FIRAMeasurement_78431add5886f7a64f080bb6c3f99898.o)
  "_kFIRNetworkHTTPStatusCodeCannotAcceptTraffic", referenced from:
      -[FIRAMeasurement networkUploadCompletionHandlerWithResponse:error:] in FirebaseAnalytics(FIRAMeasurement_78431add5886f7a64f080bb6c3f99898.o)
      -[FIRAMeasurement networkRemoteConfigFetchCompletionHandler:data:error:] in FirebaseAnalytics(FIRAMeasurement_78431add5886f7a64f080bb6c3f99898.o)
  "_OBJC_CLASS_$_FIRNetwork", referenced from:
      objc-class-ref in FirebaseAnalytics(FIRAAppDelegateProxy_35aba4039eba42413a46fea3097ce088.o)
      objc-class-ref in FirebaseAnalytics(FIRAMeasurement_78431add5886f7a64f080bb6c3f99898.o)
      objc-class-ref in FirebaseAnalytics(FIRAnalytics_20f381a67e6d70f1b973db7e9586fcd2.o)
      objc-class-ref in FirebaseCoreDiagnostics(FIRClearcutLogger_234b44acbebc395d644c77a3c7bb29ea.o)
  "_OBJC_CLASS_$_FIRMutableDictionary", referenced from:
      objc-class-ref in FirebaseAnalytics(FIRAAppDelegateProxy_35aba4039eba42413a46fea3097ce088.o)
      objc-class-ref in FirebaseAnalytics(FIRARemoteConfig_837edd22ee2d481454f086c83e2ac372.o)
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
  • To fix this error, I add two pods:
    • FirebaseMessaging
    • FirebaseRemoteConfig

Resulting in:

platform :ios, '10.0'
use_frameworks!
target 'XXX' do
        pod 'FBAudienceNetwork', '4.28.1'
        pod 'GoogleMobileAdsMediationFacebook', '4.28.1.1'
        pod 'Firebase/Firestore'
        pod 'GoogleMaps', '~> 2.7.0'
        pod 'SwiftyRSA', '~>  1.5.0'
        pod 'CryptoSwift', '~> 0.13.0'
        pod 'FirebaseMessaging'
        pod 'FirebaseRemoteConfig'
end
  • Then: pod install

  • After that, the app compile, but I get an error in Runtime:

2019-01-15 12:03:09.150246-0300 XXX[1263:341484] 5.15.0 - [Firebase/Core][I-COR000003] The default Firebase app has not yet been configured. Add `[FIRApp configure];` (`FirebaseApp.configure()` in Swift) to your application initialization. Read more: https://goo.gl/ctyzm8.
2019-01-15 12:03:09.163778-0300 XXX[1263:341265] -[FIRApp setGetTokenImplementation:]: unrecognized selector sent to instance 0x2837d54d0
2019-01-15 12:03:09.167860-0300 XXX[1263:341265] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[FIRApp setGetTokenImplementation:]: unrecognized selector sent to instance 0x2837d54d0'

Steps to Reproduce the Problem

$ ionic start testApp blank
$ cd testApp/
$ ionic cordova plugin add cordova-plugin-firestore --save --variable ANDROID_FIREBASE_CORE_VERSION=+ --variable ANDROID_FIREBASE_FIRESTORE_VERSION=17.1.0
$ ionic cordova build ios

Open platforms/ios/MyApp.xcworkspace in xcode and run

Specifications

  • Plugin version: 1.3.2
  • Framework: Ionic
Ionic:

   ionic (Ionic CLI)  : 4.3.1 (/usr/local/lib/node_modules/ionic)
   Ionic Framework    : ionic-angular 3.9.2
   @ionic/app-scripts : 3.1.9

Cordova:

   cordova (Cordova CLI) : 8.1.2 ([email protected])
   Cordova Platforms     : android 7.1.4, ios 4.5.5
   Cordova Plugins       : cordova-plugin-ionic-webview 1.2.1, (and 26 other plugins)

System:

   ios-deploy : 1.9.4
   NodeJS     : v11.1.0 (/usr/local/Cellar/node/11.1.0/bin/node)
   npm        : 6.4.1
   OS         : macOS
   Xcode      : Xcode 10.1 Build version 10B61
@ReallySmallSoftware
Copy link
Owner

As you have got as far as compiling and it is falling over at runtime, do you have some example code?

@perexlautaro
Copy link
Author

Yes, I created a repo that contains an example app that gets the same error at runtime: Ionic-Firestore-App

@perexlautaro
Copy link
Author

I could fix this error:

2019-01-15 12:03:09.150246-0300 XXX[1263:341484] 5.15.0 - [Firebase/Core][I-COR000003] The default Firebase app has not yet been configured. Add `[FIRApp configure];` (`FirebaseApp.configure()` in Swift) to your application initialization. Read more: https://goo.gl/ctyzm8.

The solution was remove this block:

if(![FIRApp defaultApp]) {
    [FIRApp configure];
}

And add:

NSString *filePath = [[NSBundle mainBundle] pathForResource:@"GoogleService-Info" ofType:@"plist"];
// if file is successfully found, use it
if(filePath){
    NSLog(@"GoogleService-Info.plist found, setup: [FIRApp configureWithOptions]");
    // create firebase configure options passing .plist as content
    FIROptions *options = [[FIROptions alloc] initWithContentsOfFile:filePath];   
    // configure FIRApp with options
    [FIRApp configureWithOptions:options];
}
// no .plist found, try default App
if (![FIRApp defaultApp] && !filePath) {
    NSLog(@"GoogleService-Info.plist NOT FOUND, setup: [FIRApp defaultApp]");
    [FIRApp configure];
}

The solution is related to this comment

Trying a little more I found that line: [FIRApp configureWithOptions:options]; (before [FIRApp configure];) crash the app

@perexlautaro
Copy link
Author

Any update on this?

@ReallySmallSoftware
Copy link
Owner

Sorry, I will try and take a look in the next few days, although I would expect the GoogleService-Info.plist to always be present. Is there a reason why it isn't?

@perexlautaro
Copy link
Author

No, there is no reason. The GoogleService-Info.plist is always present.
Don't worry, when you can. Thanks for answering!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants