Search code examples
iosswifttwitter-fabrictwitter-digits

App crash on using Fabric - Cannonball in Swift?


I've got this error when ran CannonBall: app here

'[Fabric] Value of Info.plist key "Fabric" must be a NSDictionary.'

Appdelegate.swift:

func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject : AnyObject]?) -> Bool {        
    let welcome = "Welcome to Cannonball! Please onboard with the Fabric Mac app. Check the instructions in the README file."
    //assert(NSBundle.mainBundle().objectForInfoDictionaryKey("Fabric") != nil, welcome)

    Fabric.with([Crashlytics(), Twitter(), Digits(), MoPub()])//error here


    if Twitter.sharedInstance().session() == nil && Digits.sharedInstance().session() == nil {
        let storyboard = UIStoryboard(name: "Main", bundle: nil)
        let signInViewController: AnyObject! = storyboard.instantiateViewControllerWithIdentifier("SignInViewController")
        window?.rootViewController = signInViewController as? UIViewController
    }

    return true
}

I get a suggest is "missing Fabric APIKey from your info.plist". But i can't find Fabric key in my info.plist.

Info.plist:

enter image description here


Solution

  • Add this code to your .plist file:

    <key>Fabric</key>
    <dict>
        <key>APIKey</key>
        <string>Your-key</string>
        <key>Kits</key>
        <array>
            <dict>
                <key>KitInfo</key>
                <dict/>
                <key>KitName</key>
                <string>Crashlytics</string>
            </dict>
            <dict>
                <key>KitInfo</key>
                <dict>
                    <key>consumerKey</key>
                    <string>Your-consumerKey</string>
                    <key>consumerSecret</key>
                    <string>Your-consumerSecret</string>
                </dict>
                <key>KitName</key>
                <string>Twitter</string>
            </dict>
            <dict>
                <key>KitInfo</key>
                <dict>
                    <key>consumerKey</key>
                    <string>Your-consumerKey</string>
                    <key>consumerSecret</key>
                    <string>Your-consumerSecret</string>
                </dict>
                <key>KitName</key>
                <string>Digits</string>
            </dict>
        </array>
    </dict>