2015-09-21 22 views
0

當跑的炮彈,我得到這個錯誤:app here在Swift中使用Fabric - Cannonball時應用程序崩潰?

「[面料] Info.plist的鍵‘面料’必須是一個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 
} 

我得到的建議是 「從你的info.plist缺少面料APIKey」。 但我無法在我的info.plist中找到Fabric關鍵字。

的Info.plist:

enter image description here

+0

是必須有info.plist中 –

+0

確定符合API密鑰的面料值。如何獲取consumerKey和consumerSecret的數字? –

+0

你註冊了織物嗎?/ –

回答

0

將此代碼添加到您的.plist文件:

<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>