Firebase-ios-sdk: FirebaseApp.configure() EXC_BAD_ACCESS in CFStringGetLength since Xcode 9/iOS 11

Created on 21 Sep 2017  路  8Comments  路  Source: firebase/firebase-ios-sdk

[READ] Step 1: Are you in the right place?

  • For issues or feature requests related to __the code in this repository__
    file a Github issue.

    • If this is a __feature request__ make sure the issue title starts with "FR:".

  • For general technical questions, post a question on StackOverflow
    with the firebase tag.
  • For general Firebase discussion, use the firebase-talk
    google group.
  • For help troubleshooting your application that does not fall under one
    of the above categories, reach out to the personalized
    Firebase support channel.

[REQUIRED] Step 2: Describe your environment

  • Xcode version: Xcode 9 (9A235)
  • Firebase SDK version: Firebase/Core 4.2.0
  • Library version: Firebase/Database 4.2.0, FirebaseAnalytics 4.0.3
  • Firebase Product: database/analytics (auth, database, storage, core, messaging, etc)

[REQUIRED] Step 3: Describe the problem

When I configure the FirebaseApp (by calling FirebaseApp.configure()), we get a EXC_BAD_ACCESS in CFStringGetLength. This happens since Xcode 9/iOS 11.

schermafbeelding 2017-09-21 om 09 10 36

Steps to reproduce:

  • Have a firebase project configured with analytics and database.
  • Call FirebaseApp.configure()
  • 馃挜

Relevant Code:

import UIKit
import FirebaseCore

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {

  var window: UIWindow?

  func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
    FirebaseApp.configure()
...
  }
...
}
core bug

Most helpful comment

Followup question: Are you using cocoapods, or are you downloading the frameworks and manually configuring them? If so, note that there is a resource bundled into the TagManager framework that needs to be included.

All 8 comments

A few questions:

  • What's your podfile setup?
  • Is your GoogleService-info.plist file embedded in the app correctly?
  • Have you added a GTM container file to the bundle?

Followup question: Are you using cocoapods, or are you downloading the frameworks and manually configuring them? If so, note that there is a resource bundled into the TagManager framework that needs to be included.

Thanks for your response @eburley. Let me elaborate:

  • We've setup firebase via Cocoapods. The setup is as follows:
workspace 'Project.xcworkspace'
platform :ios, '9.0'

abstract_target 'Shared' do
  use_frameworks!

  # These pods are available to all targets

  target 'Project' do
    project 'ios/Project.xcodeproj'

    # Native Pods specific for Project
    ..some pods
    pod 'GoogleTagManager', '~> 6.0'
    pod 'Firebase/Database'
    ...more pods
  end
end
  • GoogleService-info.plist is embedded properly. Our project compiles and runs in Xcode 8 and iOS 10 without a hassle.
  • Yes, the GTM container file is setup correctly.

After some digging I found that if I disable the new buildsystem (which I enabled since Xcode 9 came out), I consistently _can_ compile and run the project. This is probably a hint. Maybe bundles aren't handled correctly with the new build system?

@tomasharkema Thanks for digging deeper and sharing.

It looks like we're seeing https://github.com/CocoaPods/CocoaPods/issues/6936. There is at currently an incompatibility between CocoaPods bundles and the beta version of the Xcode 9 build system.

@paulb777 thanks, that makes sense, we've have the same issue with TwitterKitResources.bundle, as described in the CocoaPods issue.

I'll close the issue, and we'll await the issue to be resolved at CocoaPods'. Maybe you could consider making a remark on the readme that the new buildsystem has issues with the latest Cocoapods and Firebase setup?

I'm seeing this exact issue using binary framework files, though I had to get those binary frameworks from a cocoa pods-enabled app, since they aren't distributed any other way. The bundle is included in my GoogleTagManager framework. It occurs no matter what build process I'm using.

Edit: I was able to get it working by adding the TagManagerResources.bundle into the project and dropping it into Copy Bundle Resources manually. Even though it was within the Resources folder inside the GoogleTagManager.framework, it was not being found automatically (most likely this is taken care of by a normal Cocoapods install configuration).

Now fixed on CocoaPods master : https://github.com/CocoaPods/CocoaPods/pull/7209

With xcode 9.2 and cocoapods 1.4.0.beta.2 problem still exists as @tomasharkema wrote at first place.

Was this page helpful?
0 / 5 - 0 ratings