Search code examples
iosswiftpubnubtwitter-fabricgoogle-fabric

App crashing because "It appears that 'PubNub' is not a valid Fabric Kit"


Let me preface by saying that I'm using CocoaPods to manage my frameworks. I'm not sure if this really matters, but I thought you might as well know just in case. I'm also running on iOS 10.x with the latest version of Xcode (not beta).


My app is crashing on Fabric.with([Crashlytics.self, PubNub.self]) with the following error:

Terminating app due to uncaught exception 'FABException', reason: '[Fabric] It appears that "PubNub" is not a valid Fabric Kit. Please make sure you only pass Fabric Kits to [Fabric with:].'

I have updated my PodFile, cleaned my project, ran on a fresh install, ran on a physical and virtual device, and I've even uninstalled pod 'PubNub' and reinstalled it. Nothing seems to be working so far, so any help would be greatly appreciated.

My AppDelegate looks like this:

import Fabric
import Crashlytics
import PubNub

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
    /* Fabric (Answers) Debug */
    Fabric.sharedSDK().debug = true
    /* Fabric Setup */
    Fabric.with([Crashlytics.self, PubNub.self])
    return true
}

My PodFile looks like this:

# Uncomment the next line to define a global platform for your project
platform :ios, '9.1'

target 'AppName' do
    # Comment the next line if you're not using Swift and don't want to use dynamic frameworks
    use_frameworks!

    # Fabric #
    pod 'Fabric'
    pod 'Crashlytics', '~>  3.8'
    # PubNub #
    pod 'PubNub/Fabric'

    target 'AppNameTests' do
        inherit! :search_paths
        # Pods for testing
    end

    target 'AppNameUITests' do
        inherit! :search_paths
        # Pods for testing
    end
end

My Info.plist code:

<key>Fabric</key>
<dict>
    <key>APIKey</key>
    <string>##############################</string>
    <key>Kits</key>
    <array>
        <dict>
            <key>KitInfo</key>
            <dict/>
            <key>KitName</key>
            <string>Crashlytics</string>
        </dict>
        <dict>
            <key>KitInfo</key>
            <dict>
                <key>publish-key</key>
                <string>##############################</string>
                <key>secret-key</key>
                <string>##############################</string>
                <key>subscribe-key</key>
                <string>##############################</string>
            </dict>
            <key>KitName</key>
            <string>PubNub</string>
        </dict>
    </array>
</dict>

Solution

  • I'm an engineer on Fabric. I tried reproducing the issue you described above, but have not been able to do so. Things seem to work ok with a fresh Swift project and the PubNub/Fabric Cocoapod. My only suspicion is that you somehow ended up with the non-Fabric build of PubNub in your project. If there is anything else I can do to help, feel free to reach out!